diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2024-10-09 16:34:12 +0300 |
|---|---|---|
| committer | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2024-10-09 16:34:12 +0300 |
| commit | a7c282ca348c1e8e60559e5c064caee28ba11eec (patch) | |
| tree | 43bd7bdb2bbc80b92b96a14b36c33f0b7df622c9 /frontend/src/api/User.tsx | |
| parent | Rankings page (diff) | |
| download | lphub-a7c282ca348c1e8e60559e5c064caee28ba11eec.tar.gz lphub-a7c282ca348c1e8e60559e5c064caee28ba11eec.tar.bz2 lphub-a7c282ca348c1e8e60559e5c064caee28ba11eec.zip | |
refactor: so much shit
Diffstat (limited to '')
| -rw-r--r-- | frontend/src/api/User.tsx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/frontend/src/api/User.tsx b/frontend/src/api/User.tsx new file mode 100644 index 0000000..c4d1944 --- /dev/null +++ b/frontend/src/api/User.tsx | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | import axios from "axios"; | ||
| 2 | import { url } from "./Api"; | ||
| 3 | import { UserProfile } from "../types/Profile"; | ||
| 4 | |||
| 5 | export const get_user = async (user_id: string): Promise<UserProfile> => { | ||
| 6 | const response = await axios.get(url(`users/${user_id}`)); | ||
| 7 | return response.data.data; | ||
| 8 | }; | ||
| 9 | |||
| 10 | export const get_profile = async (token: string): Promise<UserProfile> => { | ||
| 11 | const response = await axios.get(url(`profile`), { | ||
| 12 | headers: { | ||
| 13 | "Authorization": token, | ||
| 14 | } | ||
| 15 | }); | ||
| 16 | return response.data.data; | ||
| 17 | }; | ||
| 18 | |||
| 19 | export const post_profile = async (token: string) => { | ||
| 20 | const _ = await axios.post(url(`profile`), {}, { | ||
| 21 | headers: { | ||
| 22 | "Authorization": token, | ||
| 23 | } | ||
| 24 | }); | ||
| 25 | }; | ||