Skip to main content
Glama

Storyden

by Southclaws
Mozilla Public License 2.0
227
useAuthProvider.ts849 B
import { usePathname, useRouter } from "next/navigation"; import { useEffect } from "react"; import { useAccountGet } from "src/api/openapi-client/accounts"; const PRIVATE_PAGES = ["/settings", "/new", "/admin"]; function privatePage(pathName: string): boolean { return PRIVATE_PAGES.includes(pathName); } export function useAuthProvider() { const { isLoading, data, error } = useAccountGet(); const { push } = useRouter(); const pathname = usePathname(); const loggedIn = Boolean(data) && !error; const isPrivate = pathname && privatePage(pathname); useEffect(() => { if (isLoading) return; if (!loggedIn && isPrivate) { push("/register"); } if (loggedIn && (pathname === "/register" || pathname === "/login")) { push("/"); } }, [isLoading, loggedIn, isPrivate, pathname, push]); return; }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Southclaws/storyden'

If you have feedback or need assistance with the MCP directory API, please join our Discord server