Skip to content

Commit

Permalink
Apply further suggestion from code review
Browse files Browse the repository at this point in the history
Co-authored-by: iammajid <[email protected]>
  • Loading branch information
SailReal and iammajid committed Feb 7, 2025
1 parent a27ed17 commit 4b749fb
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions frontend/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,11 @@ router.beforeEach((to, from, next) => {

// THIRD check user/browser keys (requires auth)
router.beforeEach(async (to) => {
let me = undefined;
if (!to.meta.skipAuth) {
me = await userdata.me;
if (me.language) {
i18n.global.locale.value = mapToLocale(me.language);
}
}
if (to.meta.skipSetup) {
return;
}
if (!me?.setupCode) {
const me = await userdata.me;
if (!me.setupCode) {
return { path: '/app/setup' };
}
const browserKeys = await userdata.browserKeys;
Expand All @@ -201,4 +195,14 @@ router.beforeEach(async (to) => {
}
});

// FOURTH apply user language
router.beforeEach(async (to) => {
if (!to.meta.skipAuth) {
const me = await userdata.me;
if (me.language) {
i18n.global.locale.value = mapToLocale(me.language);
}
}
});

export default router;

0 comments on commit 4b749fb

Please sign in to comment.