import useSWR from 'swr' import fetcher from './lib/fetcher' import withBaseUrl from './lib/withBaseURL' import { App } from './App' import { SetToken } from './components/TokenInput' import { useStore } from './useStore' export const Auth = () => { const { data: user } = useSWR(withBaseUrl('/user'), fetcher) as any const {token} = useStore((s) => ({ token: s.token })) const isLocalHost = typeof window !== 'undefined' && window.location.hostname === 'localhost' if ((window as any).__TAURI__ && !token) { return } if (!user && !isLocalHost) { return ( <>
Sign in
) } return }