ccredit user

This commit is contained in:
hamid zarghami
2026-02-24 12:14:02 +03:30
parent f5c152ccc6
commit 7e17191c1b
5 changed files with 59 additions and 4 deletions
+9
View File
@@ -0,0 +1,9 @@
import { useQuery } from "@tanstack/react-query";
import * as api from "../service/UserService";
export const useGetMe = () => {
return useQuery({
queryKey: ["me"],
queryFn: api.getMe,
});
};
+7
View File
@@ -0,0 +1,7 @@
import axios from "@/config/axios";
import type { GetMeResponseType } from "@/pages/user/types/Types";
export const getMe = async (): Promise<GetMeResponseType["data"]> => {
const { data } = await axios.get<GetMeResponseType>("/public/users/me");
return data.data;
};
+16
View File
@@ -0,0 +1,16 @@
import type { BaseResponse } from "@/shared/types/Types";
export interface UserMeType {
id: string;
createdAt: string;
deletedAt: string | null;
firstName: string | null;
lastName: string | null;
isActive: boolean;
gender: boolean;
maxCredit: number;
addresse: string | null;
phone: string;
}
export type GetMeResponseType = BaseResponse<UserMeType>;