Skip to content

Commit

Permalink
fix: fix dashboard auth redirection
Browse files Browse the repository at this point in the history
  • Loading branch information
mihirsamdarshi committed Jul 24, 2024
1 parent 7a794d0 commit ac0fe1e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/App/App.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Callback from "@/Auth/callback.jsx";
import React, { lazy, Suspense } from 'react';
import { Provider } from 'react-redux';
import { BrowserRouter, Route, Routes } from 'react-router-dom';
Expand Down Expand Up @@ -63,7 +64,6 @@ const ClinicalStudyProtocols = lazy(
const Pass1b06PhenotypeAnimalConnected = lazy(
() => import('../AnalysisPage/pass1b06PhenotypeAnimal'),
);
const CallbackConnected = lazy(() => import('../Auth/callback'));

const store = configureStore();

Expand All @@ -82,7 +82,7 @@ function App({ history = History }) {
<Route element={<PageTracker/>}>
<Route
path="/callback"
element={<CallbackConnected/>}
element={<Callback />}
/>
<Route
path="/"
Expand Down
12 changes: 4 additions & 8 deletions src/Auth/callback.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import PropTypes from 'prop-types';
import React from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { Navigate } from 'react-router-dom';
import { Navigate, useLocation } from 'react-router-dom';
import actions from './authActions';

function Callback({ location = { hash: '' } }) {
function Callback() {
const location = useLocation();

const { isAuthenticated, isFetching, message } = useSelector((state) => state.auth);
const dispatch = useDispatch();
// Handle authentication if expected values are in the URL.
Expand All @@ -26,10 +28,4 @@ function Callback({ location = { hash: '' } }) {
);
}

Callback.propTypes = {
location: PropTypes.shape({
hash: PropTypes.string,
}),
};

export default Callback;

0 comments on commit ac0fe1e

Please sign in to comment.