add: full auth functionality

add: zustand auth store
add: jwt auto refresh
This commit is contained in:
Mahyar Khanbolooki
2025-07-01 22:49:56 +03:30
parent ef63706116
commit 48c458f012
22 changed files with 340 additions and 53 deletions
+13
View File
@@ -0,0 +1,13 @@
"use client"
import { ReactQueryProvider } from '@/components/providers/ReactQueryProvider'
export default function ProfileLayout({ children }: { children: React.ReactNode }) {
return (
<ReactQueryProvider>
<div className="min-h-screen grid">
{children}
</div>
</ReactQueryProvider>
)
}
+29
View File
@@ -0,0 +1,29 @@
"use client";
import { useProfile } from '@/hooks/auth/useProfile';
import { useAuthStore } from '@/zustand/authStore';
import React, { useEffect } from 'react'
type Props = object
function ProfileIndex({ }: Props) {
const isAuthenticated = useAuthStore((state) => state.isAuthenticated);
const { mutate, data, isPending } = useProfile();
useEffect(() => {
if (isAuthenticated) {
mutate();
}
}, [isAuthenticated])
return (
<div>
{isPending && 'Loading...'}
<br />
{data && JSON.stringify(data)}
</div>
)
}
export default ProfileIndex