mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-24 23:35:23 +00:00
Added an informative UI error message for attempt to create a mixed media album
This commit is contained in:
parent
8a9a7c0e47
commit
fd4f41a14e
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]}`
|
||||
},
|
||||
|
||||
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() {
|
||||
let tags = {
|
||||
public: 'Public',
|
||||
|
@ -1395,11 +1405,19 @@ export default {
|
|||
location.href = res.data;
|
||||
}
|
||||
}).catch(err => {
|
||||
if(err.response) {
|
||||
let msg = err.response.data.message ? err.response.data.message : 'An unexpected error occured.'
|
||||
swal('Oops, something went wrong!', msg, 'error');
|
||||
} else {
|
||||
swal('Oops, something went wrong!', err.message, 'error');
|
||||
switch(err.response.status) {
|
||||
case 400:
|
||||
if (err.response.data.error == "Must contain a single photo or video or multiple photos.") {
|
||||
swal("Wrong types of mixed media", "The album must contain a single photo or video or multiple photos.", 'error');
|
||||
}
|
||||
else {
|
||||
this.defineErrorMessage(err);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
this.defineErrorMessage(err);
|
||||
break;
|
||||
}
|
||||
});
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue