Files
hspguard/web/src/api/profile.ts

16 lines
415 B
TypeScript

import type { UserProfile } from "@/types";
import { axios, handleApiError } from ".";
export type FetchProfileResponse = UserProfile;
export const fetchProfileApi = async () => {
const response = await axios.get("/api/v1/auth/profile");
if (response.status !== 200 && response.status !== 201)
throw await handleApiError(response);
const data: FetchProfileResponse = response.data;
return data;
};