ccredit user
This commit is contained in:
@@ -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,
|
||||
});
|
||||
};
|
||||
@@ -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;
|
||||
};
|
||||
@@ -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>;
|
||||
Reference in New Issue
Block a user