bugfix: the flow for trial and accept invitation (org + staff)is now unified. all navigate to dshboard if succesfull.
This commit is contained in:
@@ -15,3 +15,20 @@ export function consumeAuthRedirect(): string | null {
|
||||
if (path) sessionStorage.removeItem(AUTH_REDIRECT_KEY);
|
||||
return path;
|
||||
}
|
||||
|
||||
/** Dashboard (or a stored share-link / post-auth path). Consume once — never inside useAuth.login() or registerTrial. */
|
||||
export function appPathAfterAuth(): string {
|
||||
return consumeAuthRedirect() ?? '/today';
|
||||
}
|
||||
|
||||
/**
|
||||
* After login() on invite pages only. Multi-org already went to /select-organization.
|
||||
* Do not use useEnterAppWhenAuthenticated on invite pages.
|
||||
*/
|
||||
export function navigateIntoAppIfOrgSelected(
|
||||
replace: (href: string) => void,
|
||||
organizationCount: number,
|
||||
) {
|
||||
if (organizationCount > 1) return;
|
||||
replace(appPathAfterAuth());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user