Added /users/me route, and handling auth in frontend
This commit is contained in:
16
frontend/hooks/use-me.tsx
Normal file
16
frontend/hooks/use-me.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
"use client";
|
||||
|
||||
import IUser from "@/interfaces/IUser";
|
||||
import { useApi } from "./use-api";
|
||||
|
||||
export default function useMe() {
|
||||
const {
|
||||
data: user,
|
||||
isLoading,
|
||||
mutate,
|
||||
error,
|
||||
success,
|
||||
} = useApi<IUser>("/users/me", undefined, true);
|
||||
|
||||
return { user, isLoading, success, error, mutate };
|
||||
}
|
||||
Reference in New Issue
Block a user