Skip to content

Commit 7322fd0

Browse files
committed
fix: full page reload after signin to fix session hydration
1 parent 7852200 commit 7322fd0

2 files changed

Lines changed: 2 additions & 8 deletions

File tree

app/(auth)/signup/page.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
import { signIn } from "next-auth/react";
44
import { useState } from "react";
55
import Link from "next/link";
6-
import { useRouter } from "next/navigation";
76
import { useLocale } from "@/components/LocaleProvider";
87

98
export default function SignupPage() {
10-
const router = useRouter();
119
const { t } = useLocale();
1210
const [email, setEmail] = useState("");
1311
const [name, setName] = useState("");
@@ -36,8 +34,7 @@ export default function SignupPage() {
3634
setError(res.error);
3735
}
3836
} else if (res?.ok) {
39-
router.push("/dashboard");
40-
router.refresh();
37+
window.location.href = "/dashboard";
4138
}
4239
} catch {
4340
setError(t("login.genericError"));

app/login/page.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
import { signIn } from "next-auth/react";
44
import { useState } from "react";
55
import Link from "next/link";
6-
import { useRouter } from "next/navigation";
76
import { useLocale } from "@/components/LocaleProvider";
87

98
export default function LoginPage() {
10-
const router = useRouter();
119
const { t } = useLocale();
1210
const [email, setEmail] = useState("");
1311
const [loading, setLoading] = useState(false);
@@ -34,8 +32,7 @@ export default function LoginPage() {
3432
setError(res.error);
3533
}
3634
} else if (res?.ok) {
37-
router.push("/dashboard");
38-
router.refresh();
35+
window.location.href = "/dashboard";
3936
}
4037
} catch {
4138
setError(t("login.genericError"));

0 commit comments

Comments
 (0)