Display an error if the character can't be found or viewed

This commit is contained in:
Thaum Rystra
2020-05-21 13:36:59 +02:00
parent b640ce457f
commit c4a52ca744
3 changed files with 41 additions and 16 deletions

View File

@@ -2,7 +2,35 @@
<div class="character-sheet fill-height"> <div class="character-sheet fill-height">
<v-fade-transition mode="out-in"> <v-fade-transition mode="out-in">
<div <div
v-if="$subReady.singleCharacter" v-if="!$subReady.singleCharacter"
key="character-loading"
class="fill-height layout justify-center align-center"
>
<v-progress-circular
indeterminate
color="primary"
size="64"
/>
</div>
<div
v-else-if="!creature"
>
<v-layout
column
align-center
justify-center
>
<h2 style="margin: 48px 28px 16px">
Character not found
</h2>
<h3>
Either this character does not exist, or you don't have permission
to view it.
</h3>
</v-layout>
</div>
<div
v-else
key="character-tabs" key="character-tabs"
class="fill-height" class="fill-height"
> >
@@ -29,17 +57,6 @@
</v-tab-item> </v-tab-item>
</v-tabs-items> </v-tabs-items>
</div> </div>
<div
v-else
key="character-loading"
class="fill-height layout justify-center align-center"
>
<v-progress-circular
indeterminate
color="primary"
size="64"
/>
</div>
</v-fade-transition> </v-fade-transition>
</div> </div>
</template> </template>
@@ -94,7 +111,7 @@
}, },
}, },
creature(){ creature(){
return Creatures.findOne(this.creatureId) || {}; return Creatures.findOne(this.creatureId);
}, },
editPermission(){ editPermission(){
try { try {

View File

@@ -1,5 +1,6 @@
<template lang="html"> <template lang="html">
<v-tabs <v-tabs
v-if="creature"
slot="extension" slot="extension"
:value="value" :value="value"
centered centered
@@ -29,13 +30,20 @@
</template> </template>
<script> <script>
import Creatures from '/imports/api/creature/Creatures.js';
export default { export default {
props: { props: {
value: { value: {
type: Number, type: Number,
required: true, required: true,
}, },
} },
meteor: {
creature(){
return Creatures.findOne(this.$route.params.id);
},
},
} }
</script> </script>

View File

@@ -1,5 +1,5 @@
<template lang="html"> <template lang="html">
<v-toolbar-items> <v-toolbar-items v-if="creature">
<v-btn <v-btn
flat flat
icon icon
@@ -142,7 +142,7 @@ export default {
}, },
}, },
creature(){ creature(){
return Creatures.findOne(this.creatureId) || {}; return Creatures.findOne(this.creatureId);
}, },
editPermission(){ editPermission(){
try { try {