feat: implement sidebar and random pages for test
This commit is contained in:
@@ -7,6 +7,8 @@ interface User {
|
||||
is_active: boolean
|
||||
provider: string
|
||||
providers: string[]
|
||||
api_token?: string
|
||||
api_token_expires_at?: string | null
|
||||
}
|
||||
|
||||
interface AuthResponse {
|
||||
@@ -87,10 +89,13 @@ class AuthService {
|
||||
}
|
||||
}
|
||||
|
||||
async getOAuthProviders(): Promise<Record<string, { name: string; display_name: string }>> {
|
||||
async getOAuthProviders(): Promise<Record<
|
||||
string,
|
||||
{ name: string; display_name: string }
|
||||
> | null> {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE}/auth/providers`)
|
||||
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to get OAuth providers')
|
||||
}
|
||||
@@ -98,12 +103,8 @@ class AuthService {
|
||||
const data = await response.json()
|
||||
return data.providers
|
||||
} catch (error) {
|
||||
console.warn('Backend not available, using fallback OAuth providers')
|
||||
// Fallback OAuth providers when backend is not running
|
||||
return {
|
||||
google: { name: 'google', display_name: 'Google' },
|
||||
github: { name: 'github', display_name: 'GitHub' }
|
||||
}
|
||||
console.error('getOAuthProviders error: ', error)
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,4 +125,4 @@ class AuthService {
|
||||
}
|
||||
|
||||
export const authService = new AuthService()
|
||||
export type { User }
|
||||
export type { User }
|
||||
|
||||
Reference in New Issue
Block a user