mime-chat/src/api/account.ts
2021-05-30 14:02:59 -04:00

36 lines
635 B
TypeScript

import { useHttp } from "@/modules/http";
import axios from "axios";
const { post } = useHttp();
export const submit =
async (email: string, password: string) => (
await post('/account/login', {
email,
password
})
)
export const logout =
async (): Promise<null | Error> => (await post('/account/logout'));
export const fetchProfile = async(email: string, token: string) => (
await axios({
url: "http://127.0.0.1:3000/api/account/profile",
headers: {
Cookie: `jwt=${token}`
},
method: 'GET',
data: {
email,
}
})
)