fix: 一些基本功能
This commit is contained in:
@@ -5,11 +5,12 @@ export namespace AuthApi {
|
||||
export interface LoginParams {
|
||||
password?: string;
|
||||
username?: string;
|
||||
code?: string;
|
||||
}
|
||||
|
||||
/** 登录接口返回值 */
|
||||
export interface LoginResult {
|
||||
accessToken: string;
|
||||
token: string;
|
||||
}
|
||||
|
||||
export interface RefreshTokenResult {
|
||||
@@ -22,7 +23,19 @@ export namespace AuthApi {
|
||||
* 登录
|
||||
*/
|
||||
export async function loginApi(data: AuthApi.LoginParams) {
|
||||
return requestClient.post<AuthApi.LoginResult>('/auth/login', data);
|
||||
return requestClient.post<AuthApi.LoginResult>('login', {
|
||||
phone: data.username,
|
||||
password: data.password,
|
||||
code: data.code,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 发送验证码
|
||||
*/
|
||||
export async function sendVerificationCode(username: string) {
|
||||
return requestClient.post('send-verification-code', {
|
||||
username,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -38,7 +51,7 @@ export async function refreshTokenApi() {
|
||||
* 退出登录
|
||||
*/
|
||||
export async function logoutApi() {
|
||||
return baseRequestClient.post('/auth/logout', {
|
||||
return baseRequestClient.post('logout', {
|
||||
withCredentials: true,
|
||||
});
|
||||
}
|
||||
@@ -47,5 +60,5 @@ export async function logoutApi() {
|
||||
* 获取用户权限码
|
||||
*/
|
||||
export async function getAccessCodesApi() {
|
||||
return requestClient.get<string[]>('/auth/codes');
|
||||
return requestClient.get<string[]>('auth/codes');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user