Clan-app: fix welcome screen for initially empty clan

This commit is contained in:
Johannes Kirschbauer
2024-08-21 17:06:49 +02:00
parent 10e3664bf3
commit 1d6ff67905
7 changed files with 75 additions and 53 deletions

View File

@@ -2,12 +2,20 @@ import { Component, createEffect, Show } from "solid-js";
import { Header } from "./header";
import { Sidebar } from "../Sidebar";
import { activeURI, clanList } from "../App";
import { RouteSectionProps } from "@solidjs/router";
import { redirect, RouteSectionProps, useNavigate } from "@solidjs/router";
import { Toaster } from "solid-toast";
export const Layout: Component<RouteSectionProps> = (props) => {
const navigate = useNavigate();
createEffect(() => {
console.log("Layout props", props.location);
console.log(
"empty ClanList, redirect to welcome page",
clanList().length === 0,
);
if (clanList().length === 0) {
navigate("/welcome");
}
});
return (
<div class="h-screen bg-gradient-to-b from-white to-base-100 p-4">