fix: polish authentication navigation and autofill

This commit is contained in:
2026-09-28 23:18:05 +03:30
parent b7d5f7bc65
commit 61698ccbd9
18 changed files with 474 additions and 282 deletions

View File

@@ -1,5 +1,6 @@
import type * as Types from './types';
import { apiBaseUrl } from '@/lib/site';
import { AUTH_RETURN_TO_STORAGE_KEY, DEFAULT_AUTH_RETURN_TO, getSafeAuthReturnTo } from '@/lib/auth-return';
const API_BASE_URL =
apiBaseUrl;
@@ -221,8 +222,13 @@ class ApiClient {
});
}
async startGoogleLogin() {
async startGoogleLogin(returnTo = DEFAULT_AUTH_RETURN_TO) {
if (typeof window !== 'undefined') {
try {
window.sessionStorage.setItem(AUTH_RETURN_TO_STORAGE_KEY, getSafeAuthReturnTo(returnTo));
} catch {
// The Google flow can still continue if session storage is unavailable.
}
window.location.href = `${this.baseUrl}/api/auth/oauth/google/start`;
}
}