MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / SignUpButton

Function SignUpButton

apps/public/src/components/sign-up-button.tsx:5–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3import { Button } from './ui/button';
4
5export function SignUpButton() {
6 const [isSignedIn, setIsSignedIn] = useState(false);
7
8 useEffect(() => {
9 const check = async () => {
10 const response = await fetch(
11 'https://api.openpanel.dev/trpc/auth.session',
12 { credentials: 'include', mode: 'cors' }
13 );
14 const data = await response.json();
15 const session = data?.result?.data?.json?.session;
16 setIsSignedIn(session !== null);
17 };
18 check();
19 }, []);
20
21 return (
22 <Button asChild>
23 <Link
24 className="hidden md:flex"
25 href={`https://dashboard.openpanel.dev${isSignedIn ? '/' : '/onboarding'}`}
26 >
27 {isSignedIn ? 'Dashboard' : 'Sign up'}
28 </Link>
29 </Button>
30 );
31}

Callers

nothing calls this directly

Calls 1

checkFunction · 0.70

Tested by

no test coverage detected