I am facing an issue with getting the location asynchronously. Whenever I try to implement my code, it results in a "Maximum call stack size exceeded" error. How can I resolve this issue?
Previously, I attempted to retrieve the location by using the axios command within the messages object.
~/plugins/i18n.js
import Vue from "vue";
import VueI18n from "vue-i18n";
import axios from 'axios';
Vue.use(VueI18n);
export default async ({ app, store }) => {
app.i18n = new VueI18n({
locale: 'fr',
fallbackLocale: 'en',
messages: {
en: await axios.get('https://some-api/en/locale'),
fr: await axios.get('https://some-api/fr/locale')
}
});
}
My goal is to fetch my locales asynchronously before the page gets rendered.