Show notification if unsupported filetype

This commit is contained in:
Ferdinand Thiessen 2020-11-17 03:43:34 +01:00
parent 82d88f50d0
commit 4c9fb07f7d
2 changed files with 14 additions and 5 deletions

View File

@ -207,10 +207,16 @@ export default defineComponent({
emit('update:user', changed); emit('update:user', changed);
if (avatar.value != '') if (avatar.value != '')
void store.dispatch('user/uploadAvatar', { store
user: changed, .dispatch('user/uploadAvatar', {
file: avatar.value, user: changed,
}); file: avatar.value,
})
.catch((response: Response) => {
if (response && response.status == 400) {
onAvatarRejected();
}
});
} }
function reset() { function reset() {

View File

@ -1,7 +1,7 @@
import { Module, MutationTree, ActionTree, GetterTree } from 'vuex'; import { Module, MutationTree, ActionTree, GetterTree } from 'vuex';
import { StateInterface } from 'src/store'; import { StateInterface } from 'src/store';
import { axios } from 'boot/axios'; import { axios } from 'boot/axios';
import { AxiosResponse } from 'axios'; import { AxiosError, AxiosResponse } from 'axios';
import { SessionStorage } from 'quasar'; import { SessionStorage } from 'quasar';
import { CurrentUserResponse } from 'src/plugins/user/models'; import { CurrentUserResponse } from 'src/plugins/user/models';
@ -129,6 +129,9 @@ const actions: ActionTree<UserStateInterface, StateInterface> = {
'Content-Type': 'multipart/form-data' 'Content-Type': 'multipart/form-data'
} }
}) })
.catch((error: AxiosError) => {
return Promise.reject(error.response);
})
.finally(() => { .finally(() => {
commit('setLoading', false); commit('setLoading', false);
}); });