mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-21 14:12:42 +02:00
hard refresh on auth (#3305)
* hard refresh on auth * k * k * comment for clarity
This commit is contained in:
@@ -5,7 +5,6 @@ import { usePopup } from "@/components/admin/connectors/Popup";
|
||||
import { basicLogin, basicSignup } from "@/lib/user";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Form, Formik } from "formik";
|
||||
import { useRouter } from "next/navigation";
|
||||
import * as Yup from "yup";
|
||||
import { requestEmailVerification } from "../lib";
|
||||
import { useState } from "react";
|
||||
@@ -22,10 +21,8 @@ export function EmailPasswordForm({
|
||||
referralSource?: string;
|
||||
nextUrl?: string | null;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const { popup, setPopup } = usePopup();
|
||||
const [isWorking, setIsWorking] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
{isWorking && <Spinner />}
|
||||
@@ -69,9 +66,13 @@ export function EmailPasswordForm({
|
||||
if (loginResponse.ok) {
|
||||
if (isSignup && shouldVerify) {
|
||||
await requestEmailVerification(values.email);
|
||||
router.push("/auth/waiting-on-verification");
|
||||
// Use window.location.href to force a full page reload,
|
||||
// ensuring app re-initializes with the new state (including
|
||||
// server-side provider values)
|
||||
window.location.href = "/auth/waiting-on-verification";
|
||||
} else {
|
||||
router.push(nextUrl ? encodeURI(nextUrl) : "/");
|
||||
// See above comment
|
||||
window.location.href = nextUrl ? encodeURI(nextUrl) : "/";
|
||||
}
|
||||
} else {
|
||||
setIsWorking(false);
|
||||
|
Reference in New Issue
Block a user