diff options
Diffstat (limited to 'src/containers/Home/ReviewForm.tsx')
-rw-r--r-- | src/containers/Home/ReviewForm.tsx | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/containers/Home/ReviewForm.tsx b/src/containers/Home/ReviewForm.tsx index b626ce2..56f4f8e 100644 --- a/src/containers/Home/ReviewForm.tsx +++ b/src/containers/Home/ReviewForm.tsx @@ -1,13 +1,16 @@ import React, { useState } from 'react'; -import { useHistory } from 'react-router-dom'; import { makeStyles } from '@material-ui/core/styles'; import { TextField, Button } from '@material-ui/core'; import { Rating } from '@material-ui/lab'; import { useSnackbar } from 'notistack'; +import { useFeedback } from '../../hooks/APIClient'; import { post } from '../../requests'; -const version = 'v1.0.0'; + +interface PropTypes { + version: string; +} const useStyles = makeStyles(theme => ({ root: { @@ -19,11 +22,11 @@ const useStyles = makeStyles(theme => ({ } })); -const ReviewForm: React.FC = () => { +const ReviewForm: React.FC<PropTypes> = ({ version }) => { const [contents, setContents] = useState<string>(''); const [score, setScore] = useState<number>(0); + const { mutate: updateFeedbacks } = useFeedback(); const classes = useStyles(); - const history = useHistory(); const { enqueueSnackbar } = useSnackbar(); const handleSubmit = (): void => { @@ -32,7 +35,7 @@ const ReviewForm: React.FC = () => { enqueueSnackbar('Your feedback has been submitted!', { variant: 'success' }); - history.push('/feed'); + updateFeedbacks(); }); } }; |