You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
452 B

4 weeks ago
import { api } from "@/lib/api";
import { useQuery } from "@tanstack/react-query";
export type MeResponse = {
id: number;
name: string;
email?: string | null;
profile?: { bio?: string | null; avatarUrl?: string | null };
};
export function useMe() {
return useQuery({
queryKey: ["me"],
queryFn: async (): Promise<MeResponse> => {
const res = await api.get("/auth/me");
return res.data;
},
});
}