This commit is contained in:
Geriano
2022-09-02 08:16:37 +07:00
2 changed files with 3 additions and 3 deletions

View File

@@ -17,7 +17,7 @@ const appName = window.document.getElementsByTagName('title')[0]?.innerText || '
const { $token } = JSON.parse(document.getElementById('app').dataset.page).props const { $token } = JSON.parse(document.getElementById('app').dataset.page).props
axios.defaults.headers.common['Authorization'] = `Bearer ${$token}` axios.defaults.headers.common['Authorization'] = `Bearer ${$token}`
commons.getAllDefinedTransaction() commons.getAllDefinedTranslation()
Object.keys(commons).forEach(key => Object.defineProperty(window, key, { Object.keys(commons).forEach(key => Object.defineProperty(window, key, {
value: commons[key], value: commons[key],

View File

@@ -3,7 +3,7 @@ import { usePage } from "@inertiajs/inertia-vue3"
window.translations = {} window.translations = {}
window.locale = localStorage.getItem('locale') || 'id' window.locale = localStorage.getItem('locale') || 'id'
export const getAllDefinedTransaction = () => axios.get(route('api.translation.get', window.locale)) export const getAllDefinedTranslation = () => axios.get(route('api.translation.get', window.locale))
.then(response => response.data) .then(response => response.data)
.then(response => window.translations = response) .then(response => window.translations = response)
@@ -14,7 +14,7 @@ export const __ = (text, replacements = {}) => {
} else { } else {
axios.post(route( axios.post(route(
'api.translation.register', window.locale 'api.translation.register', window.locale
), { text }).then(getAllDefinedTransaction) ), { text }).then(getAllDefinedTranslation)
} }
for (const key in replacements) { for (const key in replacements) {