feat: add frontend auth shell

This commit is contained in:
hailin
2026-07-01 14:15:26 +08:00
parent 953f126277
commit 4925285cf3
12 changed files with 664 additions and 40 deletions

View File

@@ -0,0 +1,20 @@
import { apiRequest } from '@/lib/api'
import type { CurrentUser } from './types'
export async function getCurrentUser() {
return apiRequest<CurrentUser>('/accounts/auth/me')
}
export async function login(username: string, password: string) {
return apiRequest<CurrentUser>('/accounts/auth/login', {
method: 'POST',
body: JSON.stringify({ username, password })
})
}
export async function logout() {
await apiRequest<{ status: string }>('/accounts/auth/logout', {
method: 'POST'
})
}