Major rework: multi-user accounts (register/login, per-user data isolation), new layout with sidebar/dashboard/profile menu, matrix phase view with collapsible category columns, life timeline with ages per phase, live budget capping, collapsible transitions, mobile support
Deploy App / deploy (push) Successful in 1m47s
Deploy App / deploy (push) Successful in 1m47s
This commit is contained in:
+14
-4
@@ -8,11 +8,21 @@ import type { HouseholdInput } from "@/lib/types";
|
||||
|
||||
export default function Home() {
|
||||
const [household, setHousehold] = useState<HouseholdInput | null | undefined>(undefined);
|
||||
const [username, setUsername] = useState<string>("");
|
||||
|
||||
useEffect(() => {
|
||||
api.get<{ household: HouseholdInput | null }>("/api/household").then((data) => {
|
||||
setHousehold(data.household);
|
||||
});
|
||||
Promise.all([
|
||||
api.get<{ household: HouseholdInput | null }>("/api/household"),
|
||||
api.get<{ user: { username: string } }>("/api/auth/me"),
|
||||
])
|
||||
.then(([householdData, meData]) => {
|
||||
setUsername(meData.user.username);
|
||||
setHousehold(householdData.household);
|
||||
})
|
||||
.catch(() => {
|
||||
// Session abgelaufen/ungueltig -- Middleware leitet beim naechsten Request um.
|
||||
window.location.href = "/login";
|
||||
});
|
||||
}, []);
|
||||
|
||||
if (household === undefined) {
|
||||
@@ -27,5 +37,5 @@ export default function Home() {
|
||||
return <Onboarding onDone={setHousehold} />;
|
||||
}
|
||||
|
||||
return <AppShell initialHousehold={household} />;
|
||||
return <AppShell initialHousehold={household} username={username} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user