From 6a0b6ec911c39989a1af4322e2a32d75fddbb274 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Sat, 8 Aug 2020 09:42:16 +0300
Subject: feat: complete router navigation

---
 src/pages/LoginPage/LoginPage.tsx | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'src/pages/LoginPage/LoginPage.tsx')

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);
       });
     }
-- 
cgit v1.2.3

