Skip to content

Commit a79e099

Browse files
committed
changed navigate to redirect
1 parent 541d92f commit a79e099

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/containers/Auth/Login/Login.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useState, useContext, useEffect } from 'react';
2-
import { useNavigate, useLocation } from 'react-router';
2+
import { useLocation, redirect } from 'react-router';
33
import axios from 'axios';
44
import * as Yup from 'yup';
55
import { useLazyQuery } from '@apollo/client';
@@ -29,7 +29,6 @@ export const Login = () => {
2929
const { setAuthenticated } = useContext(SessionContext);
3030
const [authError, setAuthError] = useState('');
3131
const { i18n, t } = useTranslation();
32-
const navigate = useNavigate();
3332
const location: any = useLocation();
3433

3534
// function to unauthorize access
@@ -73,10 +72,10 @@ export const Login = () => {
7372
}
7473

7574
if (location.state?.to) {
76-
navigate(location.state.to);
75+
redirect(location.state.to);
7776
} else {
7877
// redirect to chat
79-
navigate('/chat');
78+
redirect('/chat');
8079
}
8180
}
8281
}

0 commit comments

Comments
 (0)