refactor main and rendered ipc
This commit is contained in:
parent
17e4b06948
commit
ddb2f4df0f
28 changed files with 758 additions and 211 deletions
36
src/api/account.ts
Normal file
36
src/api/account.ts
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
|
||||
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,
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
Loading…
Reference in a new issue