fix: disable SSR for login and profile pages to fix build errors

- Add export const dynamic = 'force-dynamic' to login and profile pages
- Fixes 'Google OAuth components must be used within GoogleOAuthProvider' error
- Fixes 'location is not defined' error during static generation
- Both pages now render client-side only
This commit is contained in:
soufiane 2025-11-18 16:17:29 +01:00
parent 41ab64640f
commit 867c574451
2 changed files with 4 additions and 0 deletions

View File

@ -13,6 +13,8 @@ import { useGoogleLogin } from "@react-oauth/google";
import { initFacebookSDK, loginWithFacebook } from "@/lib/facebook-sdk";
import toast from "react-hot-toast";
export const dynamic = 'force-dynamic';
export default function LoginPage() {
const { login, googleLogin, facebookLogin } = useAuth();
const [isSubmitting, setIsSubmitting] = useState(false);

View File

@ -14,6 +14,8 @@ import { useRouter } from "next/navigation";
import { ROUTES } from "@/utils/constants";
import { formatDate } from "@/utils/helpers";
export const dynamic = 'force-dynamic';
export default function ProfilePage() {
const { user, isAuthenticated, refreshUser } = useAuth();
const router = useRouter();