mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-27 12:29:41 +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 { basicLogin, basicSignup } from "@/lib/user";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Form, Formik } from "formik";
|
import { Form, Formik } from "formik";
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
import { requestEmailVerification } from "../lib";
|
import { requestEmailVerification } from "../lib";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
@@ -22,10 +21,8 @@ export function EmailPasswordForm({
|
|||||||
referralSource?: string;
|
referralSource?: string;
|
||||||
nextUrl?: string | null;
|
nextUrl?: string | null;
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter();
|
|
||||||
const { popup, setPopup } = usePopup();
|
const { popup, setPopup } = usePopup();
|
||||||
const [isWorking, setIsWorking] = useState(false);
|
const [isWorking, setIsWorking] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{isWorking && <Spinner />}
|
{isWorking && <Spinner />}
|
||||||
@@ -69,9 +66,13 @@ export function EmailPasswordForm({
|
|||||||
if (loginResponse.ok) {
|
if (loginResponse.ok) {
|
||||||
if (isSignup && shouldVerify) {
|
if (isSignup && shouldVerify) {
|
||||||
await requestEmailVerification(values.email);
|
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 {
|
} else {
|
||||||
router.push(nextUrl ? encodeURI(nextUrl) : "/");
|
// See above comment
|
||||||
|
window.location.href = nextUrl ? encodeURI(nextUrl) : "/";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setIsWorking(false);
|
setIsWorking(false);
|
||||||
|
Reference in New Issue
Block a user