add web ui and user route
This commit is contained in:
19
web/src/api/user.ts
Normal file
19
web/src/api/user.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
export type User = {
|
||||
id: number;
|
||||
login: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
deletedAt: string | null;
|
||||
};
|
||||
|
||||
export const useUserQuery = () => {
|
||||
return useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const resp = await fetch("/api/user");
|
||||
return (await resp.json()) as User;
|
||||
},
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user