improvement: QRcode and shared link added to cases inorder to make it possible for staff users to share a case info with other staffs or other clinics.
This commit is contained in:
17
frontend/src/lib/auth/postAuthRedirect.ts
Normal file
17
frontend/src/lib/auth/postAuthRedirect.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { stripLocaleFromPathname } from '@/i18n/routing';
|
||||
|
||||
const AUTH_REDIRECT_KEY = 'authRedirect';
|
||||
|
||||
export function storeAuthRedirectFromPath(pathWithOptionalLocale: string) {
|
||||
if (typeof window === 'undefined') return;
|
||||
const path = stripLocaleFromPathname(pathWithOptionalLocale);
|
||||
if (!path || path === '/login' || path === '/register') return;
|
||||
sessionStorage.setItem(AUTH_REDIRECT_KEY, path);
|
||||
}
|
||||
|
||||
export function consumeAuthRedirect(): string | null {
|
||||
if (typeof window === 'undefined') return null;
|
||||
const path = sessionStorage.getItem(AUTH_REDIRECT_KEY);
|
||||
if (path) sessionStorage.removeItem(AUTH_REDIRECT_KEY);
|
||||
return path;
|
||||
}
|
||||
Reference in New Issue
Block a user