feat: handle size quota

This commit is contained in:
lefuturiste 2020-07-29 23:23:20 +02:00
parent 1534a69f80
commit 2a4036614d
6 changed files with 68 additions and 24 deletions

View file

@ -0,0 +1 @@
VUE_APP_BASE_URL=https://associations.espacecondorcet.org

View file

@ -6,7 +6,7 @@
:vertical="$vuetify.breakpoint.mobile" :vertical="$vuetify.breakpoint.mobile"
:multi-line="$vuetify.breakpoint.mobile" :multi-line="$vuetify.breakpoint.mobile"
v-model="$store.state.alert.enabled" v-model="$store.state.alert.enabled"
:timeout="2500" :timeout="3500"
> >
{{ $store.state.alert.text }} {{ $store.state.alert.text }}

View file

@ -306,6 +306,11 @@ export default {
} else { } else {
inUrl = true inUrl = true
} }
// get the size
// this.$apitator.get('/delegate/size', { withAuth: true }).then(res => {
// console.log(res.data.data)
// })
this.$apitator.setAuthorizationToken(delegateToken) this.$apitator.setAuthorizationToken(delegateToken)
// verify the token // verify the token
@ -388,12 +393,23 @@ export default {
} }
resolve() resolve()
}).catch(err => { }).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.isSaving = false
this.$store.commit('ADD_ALERT', { if (err.response != null && err.response.status === 413) {
color: 'error', this.$store.commit('ADD_ALERT', {
text: 'Impossible de sauvegarder vos changements' 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) reject(err)
}) })
}) })

View file

@ -118,7 +118,7 @@
</v-chip> </v-chip>
</template> </template>
<template v-slot:item.actions="{ item }"> <template v-slot:item.actions="{ item }">
<v-tooltip top v-if="item.validationState === 'published' || item.validationState === 'rejected'"> <v-tooltip top v-if="item.publishedAt != null">
<template v-slot:activator="{ on, attrs }"> <template v-slot:activator="{ on, attrs }">
<v-btn icon small color="success"> <v-btn icon small color="success">
<v-icon <v-icon

View file

@ -241,12 +241,20 @@ export default {
color: 'success', color: 'success',
text: 'Couverture mise à jour !' text: 'Couverture mise à jour !'
}) })
}).catch(() => { }).catch(err => {
this.$store.commit('ADD_ALERT', { console.log(err)
color: 'error',
text: 'Impossible de mettre à jour la couverture'
})
this.coverLoading = false this.coverLoading = false
if (err.response != null && err.response.status === 413) {
this.$store.commit('ADD_ALERT', {
color: 'error',
text: 'Vous avez atteint votre quota concernant la taille des fichiers téléversés'
})
} else {
this.$store.commit('ADD_ALERT', {
color: 'error',
text: 'Impossible de mettre à jour la couverture'
})
}
}) })
}, },
loadFile (file) { loadFile (file) {
@ -288,14 +296,25 @@ export default {
this.uploadLoading = false this.uploadLoading = false
this.addMediaModal = false this.addMediaModal = false
this.files = [] this.files = []
}).catch(() => { }).catch(err => {
this.coverLoading = false console.log(err)
this.$store.commit('ADD_ALERT', {
color: 'error', this.uploadLoading = false
text: 'Impossible de téleverser ces fichiers' if (err.response != null && err.response.status === 413) {
}) this.$store.commit('ADD_ALERT', {
color: 'error',
text: 'Vous avez atteint votre quota concernant la taille des fichiers téléversés'
})
} else {
this.$store.commit('ADD_ALERT', {
color: 'error',
text: 'Impossible de téleverser ces fichiers'
})
}
}) })
}).catch(() => { }).catch(err => {
console.log(err)
this.coverLoading = false
this.$store.commit('ADD_ALERT', { this.$store.commit('ADD_ALERT', {
color: 'error', color: 'error',
text: 'Erreur de chargement des fichiers' text: 'Erreur de chargement des fichiers'

View file

@ -149,12 +149,20 @@ export default {
color: 'success', color: 'success',
text: 'Logo mis à jour !' text: 'Logo mis à jour !'
}) })
}).catch(() => { }).catch(err => {
console.log(err)
this.logoLoading = false this.logoLoading = false
this.$store.commit('ADD_ALERT', { if (err.response != null && err.response.status === 413) {
color: 'error', this.$store.commit('ADD_ALERT', {
text: 'Impossible de mettre à jour le logo' color: 'error',
}) text: 'Vous avez atteint votre quota concernant la taille des fichiers téléversés'
})
} else {
this.$store.commit('ADD_ALERT', {
color: 'error',
text: 'Impossible de mettre à jour le logo'
})
}
}) })
} }
} }