aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/api/User.ts
diff options
context:
space:
mode:
authorArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2024-11-04 13:47:50 +0300
committerGitHub <noreply@github.com>2024-11-04 13:47:50 +0300
commiteae19bb1b047b3568e7a9a624b50e80886e56331 (patch)
treeaa3215377fd1a7714e4c5763f9abf9d7dc7def2b /frontend/src/api/User.ts
parentfix: remove insert trigger on users, check insert user on login err (#224) (diff)
downloadlphub-eae19bb1b047b3568e7a9a624b50e80886e56331.tar.gz
lphub-eae19bb1b047b3568e7a9a624b50e80886e56331.tar.bz2
lphub-eae19bb1b047b3568e7a9a624b50e80886e56331.zip
feat/frontend: optimizing imports, file extensions (#230)
Co-authored-by: FifthWit <fifthwitbusiness@gmail.com>
Diffstat (limited to 'frontend/src/api/User.ts')
-rw-r--r--frontend/src/api/User.ts25
1 files changed, 25 insertions, 0 deletions
diff --git a/frontend/src/api/User.ts b/frontend/src/api/User.ts
new file mode 100644
index 0000000..88da0f2
--- /dev/null
+++ b/frontend/src/api/User.ts
@@ -0,0 +1,25 @@
1import axios from "axios";
2import { url } from "@api/Api";
3import { UserProfile } from "@customTypes/Profile";
4
5export 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
10export 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
19export const post_profile = async (token: string) => {
20 const _ = await axios.post(url(`profile`), {}, {
21 headers: {
22 "Authorization": token,
23 }
24 });
25};