37 lines
757 B
TypeScript
37 lines
757 B
TypeScript
import { httpPostJson } from "@/utils/http";
|
|
|
|
interface loginApiParams {
|
|
loginCredential: string;
|
|
password: string;
|
|
}
|
|
|
|
interface loginApiResult {
|
|
id: string;
|
|
account: string;
|
|
name: string;
|
|
email: string;
|
|
token: string;
|
|
}
|
|
|
|
export const loginApi = (params: loginApiParams) => {
|
|
return httpPostJson<loginApiResult>(`/auth/login`, params);
|
|
};
|
|
|
|
interface registerApiParams {
|
|
account: string;
|
|
name: string;
|
|
email: string;
|
|
password: string;
|
|
}
|
|
|
|
export const registerApi = (params: registerApiParams) => {
|
|
return httpPostJson<null>(`/auth/register`, params);
|
|
};
|
|
|
|
export interface forgetApiParams {
|
|
forgetCredential: string;
|
|
}
|
|
export const forgetApi = (params: forgetApiParams) => {
|
|
return httpPostJson<null>(`/auth/forget`, params);
|
|
};
|