mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 06:21:27 +00:00
Merge pull request #4886 from mbliznikova/4882_informative_err_message_for_mixed_media_album
Added an informative UI error message for attempt to create a mixed media album
This commit is contained in:
commit
fc8462d565
1 changed files with 27 additions and 9 deletions
|
@ -1094,6 +1094,16 @@ export default {
|
||||||
return `${parseFloat((bytes / Math.pow(1024, quotient)).toFixed(dec))} ${units[quotient]}`
|
return `${parseFloat((bytes / Math.pow(1024, quotient)).toFixed(dec))} ${units[quotient]}`
|
||||||
},
|
},
|
||||||
|
|
||||||
|
defineErrorMessage(errObject) {
|
||||||
|
if (errObject.response) {
|
||||||
|
let msg = errObject.response.data.message ? errObject.response.data.message : 'An unexpected error occured.';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
let msg = errObject.message;
|
||||||
|
}
|
||||||
|
return swal('Oops, something went wrong!', msg, 'error');
|
||||||
|
},
|
||||||
|
|
||||||
fetchProfile() {
|
fetchProfile() {
|
||||||
let tags = {
|
let tags = {
|
||||||
public: 'Public',
|
public: 'Public',
|
||||||
|
@ -1395,15 +1405,23 @@ export default {
|
||||||
location.href = res.data;
|
location.href = res.data;
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
if(err.response) {
|
switch(err.response.status) {
|
||||||
let msg = err.response.data.message ? err.response.data.message : 'An unexpected error occured.'
|
case 400:
|
||||||
swal('Oops, something went wrong!', msg, 'error');
|
if (err.response.data.error == "Must contain a single photo or video or multiple photos.") {
|
||||||
} else {
|
swal("Wrong types of mixed media", "The album must contain a single photo or video or multiple photos.", 'error');
|
||||||
swal('Oops, something went wrong!', err.message, 'error');
|
}
|
||||||
}
|
else {
|
||||||
});
|
this.defineErrorMessage(err);
|
||||||
return;
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
this.defineErrorMessage(err);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'delete' :
|
case 'delete' :
|
||||||
this.ids = [];
|
this.ids = [];
|
||||||
|
|
Loading…
Reference in a new issue