MCPcopy Create free account
hub / github.com/code100x/daily-code / RedirectToLoginCard

Function RedirectToLoginCard

apps/web/components/RedirectToLoginCard.tsx:5–25  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3import { Card, CardContent, CardDescription, CardHeader, CardTitle, Button } from "@repo/ui";
4
5const RedirectToLoginCard = () => {
6 const router = useRouter();
7 const pathname = usePathname();
8 const redirectToLogin = () => {
9 localStorage.setItem("loginRedirectUrl", pathname);
10 router.push("/auth");
11 };
12 return (
13 <Card className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 shadow-lg min-w-[340px]">
14 <CardHeader>
15 <CardTitle>Login to access the content</CardTitle>
16 <CardDescription>You'll be redirected back to this page after login</CardDescription>
17 </CardHeader>
18 <CardContent className="px-4">
19 <Button className="w-full mt-2" onClick={redirectToLogin}>
20 Go to Login Page
21 </Button>
22 </CardContent>
23 </Card>
24 );
25};
26
27export default RedirectToLoginCard;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected