This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { Onboarding } from "@/components/Onboarding";
|
||||
import { AppShell } from "@/components/AppShell";
|
||||
import { api } from "@/lib/api-client";
|
||||
import type { HouseholdInput } from "@/lib/types";
|
||||
|
||||
export default function Home() {
|
||||
const [household, setHousehold] = useState<HouseholdInput | null | undefined>(undefined);
|
||||
|
||||
useEffect(() => {
|
||||
api.get<{ household: HouseholdInput | null }>("/api/household").then((data) => {
|
||||
setHousehold(data.household);
|
||||
});
|
||||
}, []);
|
||||
|
||||
if (household === undefined) {
|
||||
return (
|
||||
<div className="flex flex-1 items-center justify-center">
|
||||
<p className="text-sm text-zinc-500">Laedt…</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (household === null) {
|
||||
return <Onboarding onDone={setHousehold} />;
|
||||
}
|
||||
|
||||
return <AppShell initialHousehold={household} />;
|
||||
}
|
||||
Reference in New Issue
Block a user