更新
This commit is contained in:
@@ -1,20 +1,29 @@
|
||||
import type { ApiResponse } from "../types/api";
|
||||
import { http } from "../utils/http";
|
||||
|
||||
interface LoginInput {
|
||||
import type { ApiResponse } from "@/types";
|
||||
import { http } from "@/utils";
|
||||
export interface LoginInput {
|
||||
username: string;
|
||||
password: string;
|
||||
mobile?: string;
|
||||
smsCode?: string;
|
||||
provinceCode: string;
|
||||
areaCode: string;
|
||||
tenantId: string;
|
||||
clientType?: "WEB" | "MINI";
|
||||
}
|
||||
|
||||
export interface TokenPayload {
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
tokenType: string;
|
||||
expiresIn: number;
|
||||
}
|
||||
|
||||
export async function login(input: LoginInput) {
|
||||
return http.post<ApiResponse<{ accessToken: string; refreshToken: string }>>("/auth/tokens", input);
|
||||
return http.post<ApiResponse<TokenPayload>>("/auth/tokens", input);
|
||||
}
|
||||
|
||||
export async function refreshToken(refreshToken: string) {
|
||||
return http.post<ApiResponse<{ accessToken: string; refreshToken: string }>>("/auth/tokens/refresh", {
|
||||
return http.post<ApiResponse<TokenPayload>>("/auth/tokens/refresh", {
|
||||
refreshToken
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user