fix: polish authentication navigation and autofill
This commit is contained in:
@@ -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`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user