add next app
This commit is contained in:
20
web/src/api/user.ts
Normal file
20
web/src/api/user.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { $axios } from "@/lib/axios";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
export type User = {
|
||||
id: number;
|
||||
email: string;
|
||||
login: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
};
|
||||
|
||||
export const useUserQuery = () => {
|
||||
return useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const resp = await $axios.get<User>("/user");
|
||||
return resp.data;
|
||||
},
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user