Show error on hydration problem

This commit is contained in:
rijkvanzanten
2020-08-28 16:11:51 -04:00
parent 8407694cdd
commit baaaa50049
2 changed files with 16 additions and 4 deletions

View File

@@ -6,7 +6,15 @@
</div>
</transition>
<router-view v-if="!hydrating && appAccess" />
<v-info v-if="error" type="danger" :title="$t('unexpected_error')" icon="error" center>
{{ $t('unexpected_error_copy') }}
<template #append>
<v-error :error="error" />
</template>
</v-info>
<router-view v-else-if="!hydrating && appAccess" />
<v-info v-else-if="appAccess === false" center :title="$t('no_app_access')" type="danger" icon="block">
{{ $t('no_app_access_copy') }}
@@ -82,7 +90,9 @@ export default defineComponent({
return userStore.state.currentUser?.role?.app_access;
});
return { hydrating, brandStyle, appAccess };
const error = computed(() => appStore.state.error);
return { hydrating, brandStyle, appAccess, error };
},
});
</script>

View File

@@ -11,8 +11,10 @@ export const useSettingsStore = createStore({
}),
actions: {
async hydrate() {
const response = await api.get(`/settings`, { params: { fields: ['*.*'] } });
this.state.settings = response.data.data;
try {
const response = await api.get(`/settings`, { params: { fields: ['*.*'] } });
this.state.settings = response.data.data;
} catch {}
},
async dehydrate() {