Added /users/me route, and handling auth in frontend

This commit is contained in:
cdricms
2025-01-17 15:37:01 +01:00
parent 5405cc50d9
commit eb9883a1c3
20 changed files with 453 additions and 68 deletions

16
frontend/hooks/use-me.tsx Normal file
View 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 };
}