import API_URL from "../config/api"; import type { User } from "../types"; interface ApiUserResponse { message: string; data: User; errors: null | unknown; } export function useGetCurrentUser() { async function getCurrentUser(): Promise { const response = await fetch(`${API_URL}/api/me`, { method: "GET", headers: { Accept: "application/json", "Content-Type": "application/json", Authorization: `Bearer ${localStorage.getItem("token")}` }, }); const currentUser = await response.json() as ApiUserResponse; return currentUser; } return { getCurrentUser }; }