web/satellite: better error message for duplicated bucket

WHAT:
better error message when trying to create a bucket with a name that already exists

WHY:
better user experience

Change-Id: I1f56439d6dc8503cdca03759b0cc180688aafd87
This commit is contained in:
Vitalii Shpital 2021-05-24 19:38:26 +03:00
parent b33b0a38d6
commit c410eae177

View File

@ -199,7 +199,14 @@ export default class BucketsView extends Vue {
await this.$store.dispatch(OBJECTS_ACTIONS.CREATE_BUCKET, this.createBucketName);
await this.$store.dispatch(OBJECTS_ACTIONS.FETCH_BUCKETS);
} catch (error) {
await this.$notify.error(error.message);
const BUCKET_ALREADY_EXISTS_ERROR = 'BucketAlreadyExists';
if (error.name === BUCKET_ALREADY_EXISTS_ERROR) {
await this.$notify.error('Bucket with provided name already exists.');
} else {
await this.$notify.error(error.message);
}
this.isRequestProcessing = false;
return;
@ -227,6 +234,10 @@ export default class BucketsView extends Vue {
await this.$store.dispatch(OBJECTS_ACTIONS.FETCH_BUCKETS);
} catch (error) {
await this.$notify.error(error.message);
this.isRequestProcessing = false;
return;
}
this.isRequestProcessing = false;