show profile user in header

This commit is contained in:
hamid zarghami
2025-11-27 11:51:45 +03:30
parent 9c16a6143c
commit 93fd001951
6 changed files with 66 additions and 17 deletions
@@ -0,0 +1,10 @@
import { useQuery } from "@tanstack/react-query";
import * as api from "../service/ProfileService";
export const useGetProfile = () => {
return useQuery({
queryKey: ["profile"],
queryFn: api.getProfile,
retry: false,
});
};
@@ -0,0 +1,7 @@
import { api } from "@/config/axios";
import { GetProfileResponse } from "../types/Types";
export const getProfile = async (): Promise<GetProfileResponse> => {
const { data } = await api.get<GetProfileResponse>("/public/user/me");
return data;
};
@@ -0,0 +1,23 @@
export interface UserProfile {
id: string;
createdAt: string;
updatedAt: string;
deletedAt: string | null;
restaurant: string;
firstName: string;
lastName: string;
phone: string;
birthDate: string;
marriageDate: string;
referrer: string | null;
isActive: boolean;
gender: boolean;
wallet: number;
points: number;
}
export interface GetProfileResponse {
statusCode: number;
success: boolean;
data: UserProfile;
}