import client from '@/api/client'; import type { ApiListResponse, ApiResponse } from '@/types/api'; import type { AuthUser, LoginCredentials, LoginResponse, RefreshResponse } from '../types'; /** * Endpoint constants live here (not scattered in components). * Contract per backend `aplp.backend.spring` (candidate, confirm at Phase 0). */ const ENDPOINTS = { login: '/auth/login', logout: '/auth/logout', refresh: '/auth/refresh', me: '/auth/me', } as const; export const authApi = { async login(credentials: LoginCredentials): Promise { const { data } = await client.post>(ENDPOINTS.login, credentials); return data.data; }, async logout(): Promise { await client.post(ENDPOINTS.logout); }, async refresh(): Promise { const { data } = await client.post>(ENDPOINTS.refresh); return data.data; }, async getMe(): Promise { const { data } = await client.get>(ENDPOINTS.me); return data.data; }, async listUsers(): Promise> { const { data } = await client.get>('/users'); return data; }, };