后台
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user