fix: Handle login when there are no accounts (#12816)

This commit is contained in:
Pranav
2025-11-06 20:44:59 -08:00
committed by GitHub
parent 5bf39d20e5
commit 01363042ce
5 changed files with 62 additions and 15 deletions

View File

@@ -18,8 +18,17 @@ export const validateAuthenticateRoutePermission = (to, next) => {
return '';
}
if (!to.name) {
return next(frontendURL(`accounts/${user.account_id}/dashboard`));
const { accounts = [], account_id: accountId } = user;
if (!accounts.length) {
if (to.name === 'no_accounts') {
return next();
}
return next(frontendURL('no-accounts'));
}
if (to.name === 'no_accounts' || !to.name) {
return next(frontendURL(`accounts/${accountId}/dashboard`));
}
const nextRoute = validateLoggedInRoutes(to, store.getters.getCurrentUser);