From 725aa2b09269d3d928b53509dd9cc30fe811d979 Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Mon, 10 Apr 2023 18:19:21 +0100 Subject: [PATCH] Remember page when logging in --- src/components/AuthenticationFlow/EmailLoginForm.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/AuthenticationFlow/EmailLoginForm.tsx b/src/components/AuthenticationFlow/EmailLoginForm.tsx index 6a3917806..e1ae7f15b 100644 --- a/src/components/AuthenticationFlow/EmailLoginForm.tsx +++ b/src/components/AuthenticationFlow/EmailLoginForm.tsx @@ -3,7 +3,7 @@ import type { FunctionComponent } from 'preact'; import { useState } from 'preact/hooks'; import { TOKEN_COOKIE_NAME } from '../../lib/constants'; import Spinner from '../Spinner'; -import {httpPost} from "../../lib/http"; +import { httpPost } from '../../lib/http'; const EmailLoginForm: FunctionComponent<{}> = () => { const [email, setEmail] = useState(''); @@ -46,7 +46,10 @@ const EmailLoginForm: FunctionComponent<{}> = () => { // If the response is ok, we'll set the token in a cookie Cookies.set(TOKEN_COOKIE_NAME, data.token); - window.location.href = '/'; + // Refreshing will automatically redirect to the relevant page + // Doing this to avoid redirecting to home page from any pages + // such as roadmap, best-practice etc + window.location.reload(); }) .catch((err) => { setIsLoading(false);