website refactor
This commit is contained in:
@@ -9,8 +9,9 @@
|
||||
* - Protected routes with session + wrong role: show permission error
|
||||
*/
|
||||
|
||||
import { routes, routeMatchers, RouteGroup } from '@/lib/routing/RouteConfig';
|
||||
import { routes, routeMatchers } from '@/lib/routing/RouteConfig';
|
||||
import { ConsoleLogger } from '@/lib/infrastructure/logging/ConsoleLogger';
|
||||
import { SearchParamBuilder } from '@/lib/routing/search-params/SearchParamBuilder';
|
||||
|
||||
const logger = new ConsoleLogger();
|
||||
|
||||
@@ -137,12 +138,10 @@ export class AuthFlowRouter {
|
||||
getLoginRedirectUrl(): string {
|
||||
const action = this.getAction();
|
||||
if (action.type === AuthActionType.REDIRECT_TO_LOGIN) {
|
||||
const params = new URLSearchParams({ returnTo: action.returnTo });
|
||||
return `${routes.auth.login}?${params.toString()}`;
|
||||
return `${routes.auth.login}${SearchParamBuilder.auth(action.returnTo)}`;
|
||||
}
|
||||
if (action.type === AuthActionType.SHOW_PERMISSION_ERROR) {
|
||||
const params = new URLSearchParams({ returnTo: action.requestedPath });
|
||||
return `${routes.auth.login}?${params.toString()}`;
|
||||
return `${routes.auth.login}${SearchParamBuilder.auth(action.requestedPath)}`;
|
||||
}
|
||||
throw new Error("Not in login redirect state");
|
||||
}
|
||||
@@ -234,4 +233,4 @@ export function handleAuthFlow(
|
||||
logger.info('[handleAuthFlow] Returning SHOW_PERMISSION_ERROR, redirecting to home', { homeUrl, userRole: session?.role });
|
||||
return { shouldRedirect: true, redirectUrl: homeUrl };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user