test s3 connection before set up

This commit is contained in:
Čarodej
2022-04-01 13:01:18 +02:00
parent e4d44fc5eb
commit d4199a796d
9 changed files with 139 additions and 21 deletions

View File

@@ -932,20 +932,6 @@ export default {
storage: this.storage
})
.then(() => {
events.$emit('toaster', {
type: 'success',
message: this.$t('storage_driver_updated'),
})
})
.catch(() => {
events.$emit('toaster', {
type: 'danger',
message: this.$t('popup_error.title'),
})
})
.finally(() => {
this.isSendingStorageForm = false
this.storage = {
driver: undefined,
key: undefined,
@@ -954,6 +940,28 @@ export default {
region: undefined,
bucket: undefined,
}
events.$emit('toaster', {
type: 'success',
message: this.$t('storage_driver_updated'),
})
})
.catch((error) => {
if (error.response.status === 401 && error.response.data.type === 's3-connection-error') {
events.$emit('alert:open', {
title: 'S3 Connection Error - Wrong Credentials or Not Permitted',
message: error.response.data.message,
})
} else {
events.$emit('toaster', {
type: 'danger',
message: this.$t('popup_error.title'),
})
}
})
.finally(() => {
this.isSendingStorageForm = false
})
},
async emailSetupSubmit() {