aboutsummaryrefslogtreecommitdiff
path: root/src/pages/LoginPage/LoginPage.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/pages/LoginPage/LoginPage.tsx')
-rw-r--r--src/pages/LoginPage/LoginPage.tsx6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/pages/LoginPage/LoginPage.tsx b/src/pages/LoginPage/LoginPage.tsx
index ef31491..367ed6b 100644
--- a/src/pages/LoginPage/LoginPage.tsx
+++ b/src/pages/LoginPage/LoginPage.tsx
@@ -1,4 +1,5 @@
import React, { useState, useRef } from 'react';
+import { useHistory } from 'react-router-dom';
import { makeStyles } from '@material-ui/core/styles';
import {
TextField,
@@ -7,7 +8,6 @@ import {
Switch
} from '@material-ui/core';
import { useAuth } from '../../hooks/useAuth';
-import { useNavigate } from '../../hooks/useNavigate';
const useStyles = makeStyles(theme => ({
root: {
@@ -33,7 +33,7 @@ const LoginPage: React.FC = () => {
const nameRef = useRef<HTMLInputElement>();
const passwordRef = useRef<HTMLInputElement>();
const { login } = useAuth();
- const { navigate } = useNavigate();
+ const history = useHistory();
const handleCheck = () => {
setRemember(!remember);
@@ -44,7 +44,7 @@ const LoginPage: React.FC = () => {
const password = passwordRef.current?.value;
if (name && password) {
login(name, password, remember).then(success => {
- if (success) navigate('profile');
+ if (success) history.push(`/profile/${login}`);
else setError(true);
});
}