bugfix: the flow for trial and accept invitation (org + staff)is now unified. all navigate to dshboard if succesfull.

This commit is contained in:
2026-08-19 00:39:31 +03:30
parent 6d90787c13
commit d6958b2e48
16 changed files with 138 additions and 43 deletions

View File

@@ -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());
}