From eae19bb1b047b3568e7a9a624b50e80886e56331 Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:47:50 +0300 Subject: feat/frontend: optimizing imports, file extensions (#230) Co-authored-by: FifthWit --- frontend/src/api/User.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 frontend/src/api/User.ts (limited to 'frontend/src/api/User.ts') 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 @@ +import axios from "axios"; +import { url } from "@api/Api"; +import { UserProfile } from "@customTypes/Profile"; + +export const get_user = async (user_id: string): Promise => { + const response = await axios.get(url(`users/${user_id}`)); + return response.data.data; +}; + +export const get_profile = async (token: string): Promise => { + const response = await axios.get(url(`profile`), { + headers: { + "Authorization": token, + } + }); + return response.data.data; +}; + +export const post_profile = async (token: string) => { + const _ = await axios.post(url(`profile`), {}, { + headers: { + "Authorization": token, + } + }); +}; -- cgit v1.2.3