aboutsummaryrefslogtreecommitdiff
path: root/src/pages/RegistrationPage/RegistrationPage.tsx
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-08-08 09:42:16 +0300
committereug-vs <eug-vs@keemail.me>2020-08-08 09:42:16 +0300
commit6a0b6ec911c39989a1af4322e2a32d75fddbb274 (patch)
treed6b186e7dac66cf2ba59ad1bc306719b11bf7f87 /src/pages/RegistrationPage/RegistrationPage.tsx
parent10e146ef0215d41527f0466b0e139a6805b96540 (diff)
downloadwhich-ui-6a0b6ec911c39989a1af4322e2a32d75fddbb274.tar.gz
feat: complete router navigation
Diffstat (limited to 'src/pages/RegistrationPage/RegistrationPage.tsx')
-rw-r--r--src/pages/RegistrationPage/RegistrationPage.tsx6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/pages/RegistrationPage/RegistrationPage.tsx b/src/pages/RegistrationPage/RegistrationPage.tsx
index e283a0e..9e081ca 100644
--- a/src/pages/RegistrationPage/RegistrationPage.tsx
+++ b/src/pages/RegistrationPage/RegistrationPage.tsx
@@ -1,10 +1,10 @@
import React, { useState, useRef } from 'react';
+import { useHistory } from 'react-router-dom';
import { makeStyles } from '@material-ui/core/styles';
import TextField from '@material-ui/core/TextField';
import Button from '@material-ui/core/Button';
import { post } from '../../requests';
import { useAuth } from '../../hooks/useAuth';
-import { useNavigate } from '../../hooks/useNavigate';
const useStyles = makeStyles(theme => ({
@@ -31,7 +31,7 @@ const RegistrationPage: React.FC = () => {
const emailRef = useRef<HTMLInputElement>();
const passwordRef = useRef<HTMLInputElement>();
const { login } = useAuth();
- const { navigate } = useNavigate();
+ const history = useHistory();
const onClick = () => {
const username = usernameRef.current?.value;
@@ -40,7 +40,7 @@ const RegistrationPage: React.FC = () => {
if (username && password) {
post('/users', { username, password, email })
.then(() => login(username, password))
- .then(() => navigate('profile'));
+ .then(() => history.push(`/profile/${username}`));
} else setError(true);
};