🥅 Adds graceful error hadling to widgets

This commit is contained in:
Alicia Sykes
2021-12-13 21:40:13 +00:00
parent 19d3c03001
commit 0a4d021b4e
13 changed files with 148 additions and 79 deletions

View File

@@ -6,7 +6,6 @@
<script>
import WidgetMixin from '@/mixins/WidgetMixin';
import ErrorHandler from '@/utils/ErrorHandler';
export default {
mixins: [WidgetMixin],
@@ -15,7 +14,7 @@ export default {
frameUrl() {
const usersChoice = this.options.url;
if (!usersChoice || typeof usersChoice !== 'string') {
ErrorHandler('Iframe widget expects a URL');
this.error('Iframe widget expects a URL');
return null;
}
return usersChoice;
@@ -28,7 +27,9 @@ export default {
methods: {
/* Refreshes iframe contents, called by parent */
update() {
this.startLoading();
(document.getElementById(this.frameId) || {}).src = this.frameUrl;
this.finishLoading();
},
},
};