Add password-based auth with JWT and remember-me
This commit is contained in:
1 parent
89deb869ab
commit
0042e7150c
10 files changed
+281
-37
No files matched your search
@@ -1,8 +1,12 @@
|
||||
import { RouterProvider } from "react-router-dom";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { TooltipProvider } from "@/components/ui/tooltip";
|
||||
import { Toaster } from "@/components/ui/sonner";
|
||||
import { router } from "./router";
|
||||
import { RouterProvider } from 'react-router-dom';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import { TooltipProvider } from '@/components/ui/tooltip';
|
||||
import { Toaster } from '@/components/ui/sonner';
|
||||
import { useEffect } from 'react';
|
||||
import { useAuthStore } from '@/stores/useAuthStore';
|
||||
import { LoginPage } from '@/pages/LoginPage';
|
||||
import { router } from './router';
|
||||
import { Loader2 } from 'lucide-react';
|
||||
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
@@ -15,6 +19,24 @@ const queryClient = new QueryClient({
|
||||
});
|
||||
|
||||
export function App() {
|
||||
const { isAuthenticated, isChecking, checkAuth } = useAuthStore();
|
||||
|
||||
useEffect(() => {
|
||||
checkAuth();
|
||||
}, []);
|
||||
|
||||
if (isChecking) {
|
||||
return (
|
||||
<div className="flex min-h-screen items-center justify-center bg-background">
|
||||
<Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (!isAuthenticated) {
|
||||
return <LoginPage />;
|
||||
}
|
||||
|
||||
return (
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<TooltipProvider>
|
||||
|
||||
Reference in new issue
Block a user