feat(frontend): Finalize auth refactor, routing, and resolve all code review findings

This commit is contained in:
Yunxiao Xu
2026-02-12 00:11:08 -08:00
parent 7fe020f26c
commit 2545f6df13
17 changed files with 335 additions and 216 deletions

View File

@@ -15,6 +15,7 @@ import { Input } from "@/components/ui/input"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { useState } from "react"
import { Separator } from "@/components/ui/separator"
import axios from "axios"
interface LoginFormProps {
onSuccess: () => void
@@ -39,8 +40,12 @@ export function LoginForm({ onSuccess, onToggleMode }: LoginFormProps) {
try {
await AuthService.login(values.email, values.password)
onSuccess()
} catch (err: any) {
setError(err.response?.data?.detail || "Login failed. Please check your credentials.")
} catch (err: unknown) {
if (axios.isAxiosError(err)) {
setError(err.response?.data?.detail || "Login failed. Please check your credentials.")
} else {
setError("An unexpected error occurred.")
}
} finally {
setIsLoading(false)
}
@@ -49,7 +54,8 @@ export function LoginForm({ onSuccess, onToggleMode }: LoginFormProps) {
const handleOIDCLogin = async () => {
try {
await AuthService.loginWithOIDC()
} catch (err) {
} catch (err: unknown) {
console.error("SSO Login failed:", err)
setError("Failed to initialize SSO login.")
}
}