Skip to content

Commit

Permalink
Fixed reappearing of login screen after login (#1331)
Browse files Browse the repository at this point in the history
  • Loading branch information
pateldivyesh1323 authored Dec 31, 2023
1 parent 6b5c168 commit 55deef4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ This document provides instructions on how to set up and start a running instanc
- [Installation](#installation)
- [Setting up this repository](#setting-up-this-repository)
- [Setting up npm](#setting-up-npm)
- [Setting up Typescript](#setting-up-typescript)
- [Installing required packages/dependencies](#installing-required-packagesdependencies)
- [Configuration](#configuration)
- [Creating .env file](#creating-env-file)
Expand All @@ -25,8 +26,8 @@ This document provides instructions on how to set up and start a running instanc
- [Debugging tests](#debugging-tests)
- [Linting code files](#linting-code-files)
- [Husky for Git Hooks](#husky-for-git-hooks)
- [pre-commit hook](#pre-commit-hook)
- [post-merge hook](#post-merge-hook)
- [pre-commit hook](#pre-commit-hook)
- [post-merge hook](#post-merge-hook)

<!-- tocstop -->

Expand Down
7 changes: 4 additions & 3 deletions src/screens/LoginPage/LoginPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Col from 'react-bootstrap/Col';
import Row from 'react-bootstrap/Row';
import ReCAPTCHA from 'react-google-recaptcha';
import { useTranslation } from 'react-i18next';
import { Link } from 'react-router-dom';
import { Link, useHistory } from 'react-router-dom';
import { toast } from 'react-toastify';

import { REACT_APP_USE_RECAPTCHA, RECAPTCHA_SITE_KEY } from 'Constant/constant';
Expand All @@ -26,6 +26,7 @@ import EmailOutlinedIcon from '@mui/icons-material/EmailOutlined';

function loginPage(): JSX.Element {
const { t } = useTranslation('translation', { keyPrefix: 'loginPage' });
const history = useHistory();

document.title = t('title');

Expand All @@ -51,7 +52,7 @@ function loginPage(): JSX.Element {
useEffect(() => {
const isLoggedIn = localStorage.getItem('IsLoggedIn');
if (isLoggedIn == 'TRUE') {
window.location.assign('/orglist');
history.push('/orglist');
}
setComponentLoader(false);
}, []);
Expand Down Expand Up @@ -196,7 +197,7 @@ function loginPage(): JSX.Element {
localStorage.setItem('IsLoggedIn', 'TRUE');
localStorage.setItem('UserType', loginData.login.user.userType);
if (localStorage.getItem('IsLoggedIn') == 'TRUE') {
window.location.replace('/orglist');
history.push('/orglist');
}
} else {
toast.warn(t('notAuthorised'));
Expand Down

0 comments on commit 55deef4

Please sign in to comment.