Ts assets module fix

This commit is contained in:
Jérémy Munsch 2023-12-21 18:02:37 +01:00
parent 57c690631d
commit 7fe39d4e52
No known key found for this signature in database
GPG key ID: 18361AF3BFEC0FEC
3 changed files with 8 additions and 6 deletions

View file

@ -1,6 +1,6 @@
export {};
import { AxiosStatic } from "axios";
export { };
import type VueTagsInput from "@sipec/vue3-tags-input";
import { AxiosStatic } from "axios";
// * Enum
interface EnumInterface {
@ -75,7 +75,7 @@ declare global {
Swal: Function;
vueDebug: boolean | undefined;
__SYSTEM: {
_asset: string;
_asset: Record<string, string>;
_locale: string;
_routes: Record<string, string>;
_translations: {

View file

@ -1,7 +1,7 @@
export default {
methods: {
asset(path: string) {
return `${window.__SYSTEM._asset}${path}`;
return `${window.__SYSTEM._asset[path] ?? path}`;
},
},
};

View file

@ -1,8 +1,10 @@
<script @if(isset($nonce)) nonce="{{ $nonce }}" @endif>
<script @if (isset($nonce)) nonce="{{ $nonce }}" @endif>
if (!window.__SYSTEM) {
window.__SYSTEM = {};
}
window.__SYSTEM._locale = '{{ app()->getLocale() }}';
window.__SYSTEM._translations = @json(cache(sprintf('translations.%s', app()->getLocale())) ?? []);
window.__SYSTEM._asset = '{{ asset('') }}';
if (!window.__SYSTEM._asset) {
window.__SYSTEM._asset = {};
}
</script>