initial commit, login page

This commit is contained in:
2022-11-19 17:30:58 +01:00
commit 41b49d6306
35 changed files with 4674 additions and 0 deletions

30
src/services/index.ts Normal file
View File

@@ -0,0 +1,30 @@
import { instance } from "./instance";
const handleError = (data: any) => {
if (data.resultCode === 0) {
return data;
} else {
throw new Error(data.messages[0]);
}
};
export type PostLoginArgs = {
email: string;
password: string;
rememberMe: boolean;
};
export const postLogin = async (args: PostLoginArgs) => {
const data = await instance.post("auth/login", args);
return handleError(data.data);
};
export const getMe = async () => {
const data = await instance.get("auth/me");
return handleError(data.data);
};
export const deleteMe = async () => {
const data = await instance.delete("auth/login");
return handleError(data.data);
};