create review and profile

This commit is contained in:
arifal
2026-04-20 00:25:05 +07:00
parent 7159e9108f
commit ba5f64ae0e
37 changed files with 3324 additions and 109 deletions
+19 -4
View File
@@ -1,13 +1,19 @@
"use client";
import { useState } from "react";
import { useState, Suspense } from "react";
import { signIn } from "next-auth/react";
import { useRouter } from "next/navigation";
import { useRouter, useSearchParams } from "next/navigation";
import Link from "next/link";
import Image from "next/image";
export default function LoginPage() {
function safeInternalPath(raw: string | null): string {
if (!raw || !raw.startsWith("/") || raw.startsWith("//")) return "/";
return raw;
}
function LoginForm() {
const router = useRouter();
const searchParams = useSearchParams();
const [error, setError] = useState("");
const [loading, setLoading] = useState(false);
@@ -31,7 +37,8 @@ export default function LoginPage() {
if (result?.error) {
setError(result.error);
} else {
router.push("/");
const next = safeInternalPath(searchParams.get("callbackUrl"));
router.push(next);
router.refresh();
}
}
@@ -126,3 +133,11 @@ export default function LoginPage() {
</div>
);
}
export default function LoginPage() {
return (
<Suspense fallback={null}>
<LoginForm />
</Suspense>
);
}