add error handling

This commit is contained in:
Thomas Amland
2020-07-31 14:55:21 +02:00
parent 66678c5dee
commit 29c695bbc6
5 changed files with 46 additions and 2 deletions
+3
View File
@@ -9,6 +9,7 @@
</div>
</div>
</div>
<ErrorBar/>
<footer class="footer elevated">
<Player />
</footer>
@@ -27,12 +28,14 @@
}
</style>
<script lang="ts">
import ErrorBar from "./ErrorBar.vue";
import TopNav from "./TopNav.vue";
import Sidebar from "./Sidebar.vue";
import Player from "@/player/Player.vue";
export default {
components: {
ErrorBar,
TopNav,
Sidebar,
Player,
+28
View File
@@ -0,0 +1,28 @@
<template>
<b-alert
class="fixed-top m-0 rounded-0"
variant="danger"
:show="error != null"
dismissible
@dismissed="clearError">
<template v-if="error">
<strong>{{ error.message }}</strong><br>
{{ error.stack }}
</template>
</b-alert>
</template>
<script lang="ts">
import Vue from "vue";
import { mapState, mapMutations } from 'vuex';
export default Vue.extend({
computed: {
...mapState(['error'])
},
methods: {
...mapMutations([
'clearError'
]),
},
});
</script>