File
Blob: src/client/auth/login-redirect.ts
| 1 | export function buildLoginUrl(returnTo?: string): string { |
| 2 | const target = returnTo ?? (typeof window === "undefined" ? "/" : window.location.pathname + window.location.search); |
| 3 | return `/api/v1/auth/oidc/login?return_to=${encodeURIComponent(target)}`; |
| 4 | } |
| 5 | |
| 6 | export function redirectToLogin(returnTo?: string): void { |
| 7 | if (typeof window === "undefined") return; |
| 8 | window.location.assign(buildLoginUrl(returnTo)); |
| 9 | } |