hezarfen_frontend
Clone
https://git.tahinli.com/archive/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiBdcf123aBurak Boduroğlu2 months ago674 commits
| 1 | import { Navigate } from "@tanstack/solid-router"; |
| 2 | import { type ParentProps, Show } from "solid-js"; |
| 3 | import { PageSpinner } from "@/components/ui/page-spinner"; |
| 4 | import { useAuth } from "@/stores/auth-context"; |
| 5 | |
| 6 | export function GuestGuard(props: ParentProps) { |
| 7 | const auth = useAuth(); |
| 8 | |
| 9 | return ( |
| 10 | <Show when={!auth.loading()} fallback={<PageSpinner />}> |
| 11 | <Show when={!auth.user()} fallback={<Navigate to="/" />}> |
| 12 | {props.children} |
| 13 | </Show> |
| 14 | </Show> |
| 15 | ); |
| 16 | } |