Mutate the store after uploading

This commit is contained in:
Dane Everitt 2020-08-22 22:36:53 -07:00
parent b4c64d3dc0
commit f21aca20b2
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53

View file

@ -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' });