Commit 07f52687 authored by pestov's avatar pestov
Browse files

feat: add second image error message type

parent ee1d5e6f
Pipeline #231378 passed with stages
in 3 minutes and 59 seconds
......@@ -26,6 +26,7 @@
:contenttypes="contentTypes"
:contenturls="contentUrls"
:errormessage="errormessage"
:error-image="errorImage"
:fontsize="fontsize"
:imageurl="imageurl"
:isloading="isLoading"
......@@ -67,6 +68,7 @@ export default {
contentTypes: [],
contentUrls: [],
errormessage: false,
errorImage: null,
fontsize: 16,
imageurl: '',
isCollection: false,
......@@ -272,18 +274,30 @@ export default {
}
if (data.image) {
this.imageurl = data.image.id || '';
this.imageurl = data.image.id;
fetch(this.imageurl).then((response) => {
if (response.status === 200 || response.status === 201) {
this.errormessage = false;
this.errorImage = null;
} else {
// for vpn error.
this.errormessage = true;
this.errorImage = {
messageKey: 'imageErrorMessageVPN',
};
}
}).catch(() => {
// for CORS error.
this.errormessage = true;
this.errorImage = {
messageKey: 'imageErrorMessageVPN',
};
});
} else {
this.errormessage = true;
this.errorImage = {
messageKey: 'imageErrorMessageNotExists',
};
}
});
},
......
<template>
<div
v-if="errormessage"
v-if="errorImage"
class="q-pa-sm"
>
<Notification
:message="$t(messages.none)"
:message="$t(errorImage.messageKey)"
:notification-colors="config.notificationColors"
title-key="imageErrorTitle"
type="warning"
......@@ -63,6 +63,10 @@ export default {
type: Boolean,
default: () => false,
},
errorImage: {
type: Object,
default: () => null,
},
imageurl: {
type: String,
default: () => '',
......@@ -88,13 +92,10 @@ export default {
homeButton: 'default',
fullPageButton: 'fullscreen',
},
messages: {
none: 'imageErrorMessage',
},
};
},
mounted() {
if (this.errormessage) {
if (this.errorImage !== null) {
return;
}
......
......@@ -117,6 +117,10 @@ export default {
type: Boolean,
default: () => false,
},
errorImage: {
type: Object,
default: () => null,
},
isloading: {
type: Boolean,
default: false,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment