fix(plexseries): add guards to protect when roles and genre are missing

This commit is contained in:
Travis Shivers 2020-09-09 21:41:24 -05:00
parent 0023ba9252
commit 780e834fce
No known key found for this signature in database
GPG Key ID: EE4CC2891B8FCD33
1 changed files with 32 additions and 36 deletions

View File

@ -56,7 +56,7 @@
{{ metadata.summary }} {{ metadata.summary }}
</p> </p>
<div> <div v-if="genres.length > 0">
<v-chip <v-chip
v-for="genre in genres" v-for="genre in genres"
:key="genre.tag" :key="genre.tag"
@ -68,6 +68,7 @@
</v-chip> </v-chip>
</div> </div>
<template v-if="roles.length > 0">
<v-subheader class="white--text"> <v-subheader class="white--text">
Featuring Featuring
</v-subheader> </v-subheader>
@ -97,6 +98,7 @@
</v-chip> </v-chip>
</v-col> </v-col>
</v-row> </v-row>
</template>
</v-container> </v-container>
</v-col> </v-col>
</v-row> </v-row>
@ -181,17 +183,11 @@ export default {
}, },
roles() { roles() {
if (!this.metadata) { return this.metadata?.Role?.slice(0, 6) || [];
return [];
}
return this.metadata.Role.slice(0, 6);
}, },
genres() { genres() {
if (!this.metadata) { return this.metadata?.Genre?.slice(0, 5) || [];
return [];
}
return this.metadata.Genre.slice(0, 5);
}, },
thumb() { thumb() {