From 2a4036614db25bd727b26e0d91df1b939b7db35c Mon Sep 17 00:00:00 2001 From: lefuturiste Date: Wed, 29 Jul 2020 23:23:20 +0200 Subject: [PATCH] feat: handle size quota --- .env.example | 1 + src/components/GlobalSnackbar.vue | 2 +- src/layouts/Delegate.vue | 26 +++++++++++++---- src/views/Admin/OrganizationList.vue | 2 +- src/views/Delegate/Gallery.vue | 43 ++++++++++++++++++++-------- src/views/Delegate/Main.vue | 18 ++++++++---- 6 files changed, 68 insertions(+), 24 deletions(-) diff --git a/.env.example b/.env.example index e69de29..0996c28 100644 --- a/.env.example +++ b/.env.example @@ -0,0 +1 @@ +VUE_APP_BASE_URL=https://associations.espacecondorcet.org \ No newline at end of file diff --git a/src/components/GlobalSnackbar.vue b/src/components/GlobalSnackbar.vue index 89c7932..0f4671a 100644 --- a/src/components/GlobalSnackbar.vue +++ b/src/components/GlobalSnackbar.vue @@ -6,7 +6,7 @@ :vertical="$vuetify.breakpoint.mobile" :multi-line="$vuetify.breakpoint.mobile" v-model="$store.state.alert.enabled" - :timeout="2500" + :timeout="3500" > {{ $store.state.alert.text }} diff --git a/src/layouts/Delegate.vue b/src/layouts/Delegate.vue index 4ea68a4..8752a68 100644 --- a/src/layouts/Delegate.vue +++ b/src/layouts/Delegate.vue @@ -306,6 +306,11 @@ export default { } else { inUrl = true } + + // get the size + // this.$apitator.get('/delegate/size', { withAuth: true }).then(res => { + // console.log(res.data.data) + // }) this.$apitator.setAuthorizationToken(delegateToken) // verify the token @@ -388,12 +393,23 @@ export default { } resolve() }).catch(err => { - console.log(err.data) + console.log(err.response) + if (err.response != null) { + console.log(err.response.data) + console.log(err.response.code) + } this.isSaving = false - this.$store.commit('ADD_ALERT', { - color: 'error', - text: 'Impossible de sauvegarder vos changements' - }) + if (err.response != null && err.response.status === 413) { + this.$store.commit('ADD_ALERT', { + color: 'error', + text: 'Le contenu renseigné est trop grand, vous devez le réduire' + }) + } else { + this.$store.commit('ADD_ALERT', { + color: 'error', + text: 'Impossible de sauvegarder vos changements' + }) + } reject(err) }) }) diff --git a/src/views/Admin/OrganizationList.vue b/src/views/Admin/OrganizationList.vue index c34f1f0..40e9c97 100644 --- a/src/views/Admin/OrganizationList.vue +++ b/src/views/Admin/OrganizationList.vue @@ -118,7 +118,7 @@