30 lines
653 B
TypeScript
30 lines
653 B
TypeScript
import request from '@/utils/http'
|
|
import type { AdminCaptcha, AdminLoginResult } from '@/types/admin'
|
|
|
|
export interface LoginBody {
|
|
username: string
|
|
password: string
|
|
captchaId: string
|
|
captchaCode: string
|
|
}
|
|
|
|
export function fetchCaptcha() {
|
|
return request.get<AdminCaptcha>({
|
|
url: '/api/admin/auth/captcha'
|
|
})
|
|
}
|
|
|
|
export function fetchLogin(data: LoginBody) {
|
|
return request.post<AdminLoginResult>({
|
|
url: '/api/admin/auth/login',
|
|
data
|
|
})
|
|
}
|
|
|
|
export function fetchChangePassword(data: { oldPassword: string; newPassword: string }) {
|
|
return request.post<{ ok?: boolean }>({
|
|
url: '/api/admin/auth/password',
|
|
data
|
|
})
|
|
}
|