Add banner state/fetch before loading check
cgen-96248927e0f943f3b7ae10528295dcd6
This commit is contained in:
parent
34e3593d04
commit
916dde0194
1 changed files with 11 additions and 0 deletions
|
|
@ -242,6 +242,17 @@ export default function Index() {
|
|||
},
|
||||
];
|
||||
|
||||
const [homeBanner, setHomeBanner] = useState<{ text: string; enabled?: boolean; style?: string } | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
fetch("/api/site-settings?key=home_banner")
|
||||
.then((r) => (r.ok ? r.json() : null))
|
||||
.then((v) => {
|
||||
if (v && typeof v === "object") setHomeBanner(v as any);
|
||||
})
|
||||
.catch(() => void 0);
|
||||
}, []);
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<LoadingScreen
|
||||
|
|
|
|||
Loading…
Reference in a new issue