Fix frontend login flow: merge v3 auth routes, fix vite proxy, SPA redirect
This commit is contained in:
@@ -12,12 +12,25 @@ const routes = [...dashboard.routes];
|
||||
|
||||
export const router = createRouter({ history: createWebHistory(), routes });
|
||||
|
||||
const PUBLIC_ROUTE_NAMES = [
|
||||
'login',
|
||||
'sso_login',
|
||||
'auth_signup',
|
||||
'auth_confirmation',
|
||||
'auth_verify_email',
|
||||
'auth_password_edit',
|
||||
'auth_reset_password',
|
||||
];
|
||||
|
||||
export const validateAuthenticateRoutePermission = async (to, next) => {
|
||||
const { isLoggedIn, getCurrentUser: user } = store.getters;
|
||||
|
||||
if (PUBLIC_ROUTE_NAMES.includes(to.name)) {
|
||||
return next();
|
||||
}
|
||||
|
||||
if (!isLoggedIn) {
|
||||
window.location.assign('/app/login');
|
||||
return '';
|
||||
return next(frontendURL('login'));
|
||||
}
|
||||
|
||||
const { accounts = [], account_id: accountId } = user;
|
||||
|
||||
Reference in New Issue
Block a user