use state board when available in board placeholder

This commit is contained in:
Gamebrary 2020-08-25 21:26:58 -07:00
parent 07d8327f45
commit 8ff82d26c4

View file

@ -1,7 +1,7 @@
<template lang="html"> <template lang="html">
<div class="gameboard-placeholder"> <div class="gameboard-placeholder">
<div <div
v-for="list in board.lists" v-for="list in placeholderBoard.lists"
:class="`list ${list.settings.view || 'single'}`" :class="`list ${list.settings.view || 'single'}`"
:key="list.name" :key="list.name"
> >
@ -35,18 +35,20 @@ export default {
data() { data() {
return { return {
board: {}, placeholderBoard: {},
}; };
}, },
computed: { computed: {
...mapState(['boards']), ...mapState(['boards', 'board']),
}, },
mounted() { mounted() {
const boardId = this.$route.params.id; const boardId = this.$route.params.id;
this.board = this.boards.find(({ id }) => id === boardId); this.placeholderBoard = Object.keys(this.board).length > 0
? this.board
: this.boards.find(({ id }) => id === boardId);
}, },
}; };
</script> </script>