feat(frontend): Finalize auth refactor, routing, and resolve all code review findings
This commit is contained in:
@@ -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.")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user