From 5b81a690ed3c407aeb934b92fdad4a37c7e01a4b Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Fri, 9 Oct 2020 03:31:07 +0300
Subject: fix: update feedback list after review

---
 src/containers/Home/ReviewForm.tsx | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'src')

diff --git a/src/containers/Home/ReviewForm.tsx b/src/containers/Home/ReviewForm.tsx
index 32f3b19..56f4f8e 100644
--- a/src/containers/Home/ReviewForm.tsx
+++ b/src/containers/Home/ReviewForm.tsx
@@ -1,9 +1,9 @@
 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';
 
@@ -25,8 +25,8 @@ const useStyles = makeStyles(theme => ({
 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 => {
@@ -35,7 +35,7 @@ const ReviewForm: React.FC<PropTypes> = ({ version }) => {
         enqueueSnackbar('Your feedback has been submitted!', {
           variant: 'success'
         });
-        history.push('/feed');
+        updateFeedbacks();
       });
     }
   };
-- 
cgit v1.2.3