Merge branch 'master' of https://github.com/Geriano/laravel-inertia-vite-template
This commit is contained in:
@@ -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],
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user