This commit is contained in:
浅念
2026-08-27 16:11:49 +08:00
commit 2d8ef3d7bb
104 changed files with 20196 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
import request from '@/api/request'
/** Shape of a successful POST /api/auth/login response. */
export interface LoginResponse {
token: string
expiresIn: string
}
/**
* POST /api/auth/login with username + password.
* Throws a normalized {@link ApiError} (from the response interceptor) on
* failure — e.g. status 401 with message "invalid credentials".
*/
export async function loginApi(
username: string,
password: string,
): Promise<LoginResponse> {
const { data } = await request.post<LoginResponse>('/auth/login', {
username,
password,
})
return data
}