This commit is contained in:
2026-04-17 16:31:32 +08:00
parent adadb3bf1d
commit 2476655b28
116 changed files with 3875 additions and 583 deletions

View File

@@ -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
});
}