feat: auth flow

This commit is contained in:
talksik
2026-02-19 20:36:08 -08:00
parent 1f249c47a6
commit 144596fcaa
16 changed files with 559 additions and 24 deletions
+23 -21
View File
@@ -1,27 +1,29 @@
import { useEffect, useState } from 'react';
import { Button } from '@/components/ui/button';
import { P, H1 } from '@/components/ui/typography';
import { useEffect } from "react";
import { useAuthStore } from "@/stores/auth-store";
import { LoginPage } from "@/features/auth/login-page";
import { HomePage } from "@/pages/home-page";
const App = () => {
useEffect(
() => {
console.log('loaded');
},
[]
);
const [state, updateState] = useState(1);
const status = useAuthStore((s) => s.status);
const restoreSession = useAuthStore((s) => s.restoreSession);
return (
<div>
<H1>Hello World!</H1>
<P>Welcome to your Electron application.</P>
<P>What is the purpose of this app</P>
<Button onClick={() => {
console.log(state);
updateState(state + 1);
}}>Click me</Button>
</div>
);
useEffect(() => {
restoreSession();
}, [restoreSession]);
if (status === "idle" || status === "restoring") {
return (
<div className="flex min-h-screen items-center justify-center">
<p className="text-muted-foreground text-sm">Loading...</p>
</div>
);
}
if (status === "authenticated") {
return <HomePage />;
}
return <LoginPage />;
};
export default App;