add login on button
This commit is contained in:
1 parent
e6c839dd08
commit
d59304f833
1 file changed
+10
-1
@@ -2,6 +2,7 @@
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { apiFetch, type Job } from "@/lib/api";
|
||||
import { useMe } from "@/lib/auth";
|
||||
import { GATE_META, type PlayreelJob } from "@/lib/playreel";
|
||||
@@ -36,6 +37,7 @@ function tone(status: string) {
|
||||
}
|
||||
|
||||
export default function HomePage() {
|
||||
const router = useRouter();
|
||||
const { me } = useMe();
|
||||
const [recent, setRecent] = useState<Recent[]>([]);
|
||||
|
||||
@@ -85,7 +87,14 @@ export default function HomePage() {
|
||||
<div key={k}><b>{k}</b><span>{v}</span></div>
|
||||
))}
|
||||
</div>
|
||||
<Link href={e.href} className="btn-cta btn-lg" style={{ textDecoration: "none" }}>{e.cta}</Link>
|
||||
{/* 여기서 처음으로 로그인이 필요해진다. Link 는 그대로 둬서
|
||||
새 탭으로 열거나 주소를 복사하는 동작은 살린다 */}
|
||||
<Link href={e.href} className="btn-cta btn-lg" style={{ textDecoration: "none" }}
|
||||
onClick={(event) => {
|
||||
if (me !== false) return;
|
||||
event.preventDefault();
|
||||
router.push(`/login?next=${encodeURIComponent(e.href)}`);
|
||||
}}>{e.cta}</Link>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user