From f21aca20b2a6718194d2d91d05aacb5373db6cc1 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 22 Aug 2020 22:36:53 -0700 Subject: [PATCH] Mutate the store after uploading --- resources/scripts/components/server/files/UploadButton.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/scripts/components/server/files/UploadButton.tsx b/resources/scripts/components/server/files/UploadButton.tsx index 8b48052bd..f119b0d91 100644 --- a/resources/scripts/components/server/files/UploadButton.tsx +++ b/resources/scripts/components/server/files/UploadButton.tsx @@ -10,6 +10,7 @@ import Fade from '@/components/elements/Fade'; import useEventListener from '@/plugins/useEventListener'; import SpinnerOverlay from '@/components/elements/SpinnerOverlay'; import useFlash from '@/plugins/useFlash'; +import useFileManagerSwr from '@/plugins/useFileManagerSwr'; const InnerContainer = styled.div` max-width: 600px; @@ -20,6 +21,7 @@ export default () => { const { uuid } = useServer(); const [ visible, setVisible ] = useState(false); const [ loading, setLoading ] = useState(false); + const { mutate } = useFileManagerSwr(); const { clearFlashes, clearAndAddHttpError } = useFlash(); useEventListener('dragenter', e => { @@ -63,9 +65,7 @@ export default () => { 'Content-Type': 'multipart/form-data', }, })) - .then(res => { - console.log(res); - }) + .then(() => mutate()) .catch(error => { console.error(error); clearAndAddHttpError({ error, key: 'files' });