Skip to main content
Glama
orneryd

M.I.M.I.R - Multi-agent Intelligent Memory & Insight Repository

by orneryd
ProtectedRoute.tsx1.36 kB
import { useEffect, useState } from 'react'; import { Navigate } from 'react-router-dom'; import { api } from '../utils/api'; interface ProtectedRouteProps { children: React.ReactNode; } export function ProtectedRoute({ children }: ProtectedRouteProps) { const [authState, setAuthState] = useState<'loading' | 'authenticated' | 'unauthenticated'>('loading'); useEffect(() => { // First check if auth is even enabled api.getAuthConfig().then(config => { if (!config.securityEnabled) { // Auth disabled - allow access setAuthState('authenticated'); return; } // Auth enabled - check if authenticated api.checkAuth().then(result => { setAuthState(result.authenticated ? 'authenticated' : 'unauthenticated'); }); }); }, []); if (authState === 'loading') { return ( <div className="min-h-screen flex items-center justify-center bg-norse-night"> <div className="flex flex-col items-center gap-4"> <div className="w-12 h-12 border-4 border-nornic-primary border-t-transparent rounded-full animate-spin" /> <span className="text-norse-silver">Connecting to NornicDB...</span> </div> </div> ); } if (authState === 'unauthenticated') { return <Navigate to="/login" replace />; } return <>{children}</>; }

Latest Blog Posts

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/orneryd/Mimir'

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