feat(lst): tan stack routes added with protected routes
This commit is contained in:
@@ -15,7 +15,7 @@ const fetchSession = async () => {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
});
|
||||
console.log(res);
|
||||
// console.log(res);
|
||||
if (!res.ok) {
|
||||
throw new Error("Session not found");
|
||||
}
|
||||
@@ -31,7 +31,7 @@ export const useSession = () => {
|
||||
queryKey: ["session"],
|
||||
queryFn: fetchSession,
|
||||
enabled: !!token, // Prevents query if token is null
|
||||
staleTime: 5 * 60 * 1000, // 5 mins
|
||||
staleTime: 60 * 1000,
|
||||
gcTime: 10 * 60 * 1000, // 10 mins
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
@@ -47,3 +47,5 @@ export const useSession = () => {
|
||||
|
||||
return {session: data && token ? {user: data.user, token: data.token} : null, status, error};
|
||||
};
|
||||
|
||||
export type SessionType = ReturnType<typeof useSession>;
|
||||
|
||||
Reference in New Issue
Block a user