Код: Выделить всё
SettingsPage.vue
Код: Выделить всё
onMounted(async () => {
// Fetch available locales from API
availableLocales.value = await api.locale.getLocales().then((response => response.locales))
// Fetch user settings from API
var settings = await api.user.getUserSettings().then(response => {
console.log(response.userSettings)
// Correctly displays the object, including all the values of all properties correctly
//{mainLocale: ?, darkMode: ? etc...}
console.log(response.userSettings.mainLocale)
// Displays undefined
Код: Выделить всё
api.ts
Код: Выделить всё
getUserSettings: async (): Promise => {
return await axiosService.get(`/api/user/settings/get`).then((response) => response.data);
},
Я осмотрелся и попробовал различные «хаки», такие как JSON.parse(JSON.stringify(response.userSettings)), и ничего сработало.
Подробнее здесь: https://stackoverflow.com/questions/793 ... ole-object