Added various conditions to prevent errors and warnings.

This commit is contained in:
DebaucheryLibrarian 2021-03-04 02:35:43 +01:00
parent 0c98df232e
commit fa30fe5169
7 changed files with 37 additions and 14 deletions

View File

@ -363,6 +363,7 @@
<Pagination <Pagination
:items-total="totalCount" :items-total="totalCount"
:items-per-page="limit" :items-per-page="limit"
name="actorRange"
class="pagination-top" class="pagination-top"
/> />
</div> </div>
@ -409,7 +410,7 @@ function showAlbum() {
} }
async function watchRoute(to, from) { async function watchRoute(to, from) {
if (to.hash !== '#album' && from.hash !== '#album') { if ((to.name === 'actor' || to.name === 'actorRange') && to.hash !== '#album' && from.hash !== '#album') {
await this.fetchActor(); await this.fetchActor();
} }
} }

View File

@ -1,6 +1,9 @@
<template> <template>
<div class="actors"> <div class="actors">
<nav class="filter"> <nav
ref="filter"
class="filter"
>
<ul class="genders nolist"> <ul class="genders nolist">
<li class="gender"> <li class="gender">
<router-link <router-link
@ -219,7 +222,7 @@
v-if="totalCount > 0" v-if="totalCount > 0"
:items-total="totalCount" :items-total="totalCount"
:items-per-page="limit" :items-per-page="limit"
class="pagination-top" class="pagination-bottom"
/> />
<Footer /> <Footer />
@ -241,7 +244,11 @@ const boobSizes = 'ABCDEFGHZ'.split('');
function updateFilters() { function updateFilters() {
this.$router.push({ this.$router.push({
name: 'actors', name: 'actors',
params: this.$route.params, params: {
pageNumber: 1,
gender: this.gender,
letter: this.letter,
},
query: { query: {
nb: this.naturalBoobs !== 1 ? this.naturalBoobs : undefined, nb: this.naturalBoobs !== 1 ? this.naturalBoobs : undefined,
bs: this.boobSizeRequired ? this.boobSize.join(',') : undefined, bs: this.boobSizeRequired ? this.boobSize.join(',') : undefined,
@ -281,7 +288,7 @@ async function fetchActors(scroll) {
this.totalCount = totalCount; this.totalCount = totalCount;
if (scroll) { if (scroll) {
this.$refs.pagination.$el.scrollIntoView(); this.$refs.filter?.scrollIntoView();
} }
} }

View File

@ -39,7 +39,7 @@ async function fetchReleases() {
this.totalCount = totalCount; this.totalCount = totalCount;
this.releases = releases; this.releases = releases;
this.$refs.filter.$el.scrollIntoView(); this.$refs.filter?.$el.scrollIntoView();
} }
async function mounted() { async function mounted() {

View File

@ -9,12 +9,12 @@
> >
<router-link <router-link
class="pagination-button cursor" class="pagination-button cursor"
:to="{ params: { pageNumber: 1 }, query: $route.query }" :to="{ name, params: { ...params, pageNumber: 1 }, query: $route.query }"
><Icon icon="first2" /></router-link> ><Icon icon="first2" /></router-link>
<router-link <router-link
class="pagination-button cursor" class="pagination-button cursor"
:to="{ params: { pageNumber: pageNumber - 1 }, query: $route.query }" :to="{ name, params: { ...params, pageNumber: pageNumber - 1 }, query: $route.query }"
><Icon icon="arrow-left" /></router-link> ><Icon icon="arrow-left" /></router-link>
</span> </span>
@ -30,14 +30,14 @@
<router-link <router-link
v-for="pageX in pageNumber - 1" v-for="pageX in pageNumber - 1"
:key="`page-${pageX}`" :key="`page-${pageX}`"
:to="{ params: { pageNumber: pageNumber - pageX }, query: $route.query }" :to="{ name, params: { ...params, pageNumber: pageNumber - pageX }, query: $route.query }"
class="pagination-button page" class="pagination-button page"
> {{ pageNumber - pageX }} </router-link> > {{ pageNumber - pageX }} </router-link>
</span> </span>
<router-link <router-link
:key="`page-${pageNumber}`" :key="`page-${pageNumber}`"
:to="{ params: { pageNumber }, query: $route.query }" :to="{ name, params: { ...params, pageNumber }, query: $route.query }"
class="pagination-button page active" class="pagination-button page active"
> {{ pageNumber }} </router-link> > {{ pageNumber }} </router-link>
@ -45,7 +45,7 @@
<router-link <router-link
v-for="pageX in (pageCount - pageNumber)" v-for="pageX in (pageCount - pageNumber)"
:key="`page-${pageX + pageNumber}`" :key="`page-${pageX + pageNumber}`"
:to="{ params: { pageNumber: pageX + pageNumber }, query: $route.query }" :to="{ name, params: { ...params, pageNumber: pageX + pageNumber }, query: $route.query }"
class="pagination-button page" class="pagination-button page"
> {{ pageX + pageNumber }} </router-link> > {{ pageX + pageNumber }} </router-link>
</span> </span>
@ -56,12 +56,12 @@
> >
<router-link <router-link
class="pagination-button cursor" class="pagination-button cursor"
:to="{ params: { pageNumber: pageNumber + 1 }, query: $route.query }" :to="{ name, params: { ...params, pageNumber: pageNumber + 1 }, query: $route.query }"
><Icon icon="arrow-right" /></router-link> ><Icon icon="arrow-right" /></router-link>
<router-link <router-link
class="pagination-button cursor" class="pagination-button cursor"
:to="{ params: { pageNumber: pageCount }, query: $route.query }" :to="{ name, params: { ...params, pageNumber: pageCount }, query: $route.query }"
><Icon icon="last2" /></router-link> ><Icon icon="last2" /></router-link>
</span> </span>
@ -100,6 +100,14 @@ export default {
type: Boolean, type: Boolean,
default: true, default: true,
}, },
name: {
type: String,
default: null,
},
params: {
type: Object,
default: null,
},
}, },
computed: { computed: {
pageNumber, pageNumber,

View File

@ -167,6 +167,7 @@ export default {
default: null, default: null,
}, },
}, },
emits: ['load'],
data() { data() {
return { return {
player: null, player: null,

View File

@ -218,8 +218,10 @@ async function fetchRelease() {
this.release = await this.$store.dispatch('fetchMovieById', this.$route.params.releaseId); this.release = await this.$store.dispatch('fetchMovieById', this.$route.params.releaseId);
} }
if (this.$refs.content) {
this.$refs.content.scrollTop = 0; this.$refs.content.scrollTop = 0;
} }
}
function bannerBackground() { function bannerBackground() {
return (this.release.poster && this.getBgPath(this.release.poster, 'thumbnail')) return (this.release.poster && this.getBgPath(this.release.poster, 'thumbnail'))

View File

@ -13,6 +13,10 @@ function initActorActions(store, router) {
pageNumber = 1, pageNumber = 1,
range = 'latest', range = 'latest',
}) { }) {
if (!actorId) {
return null;
}
const { before, after, orderBy } = getDateRange(range); const { before, after, orderBy } = getDateRange(range);
const includedTags = router.currentRoute.value.query.tags ? router.currentRoute.value.query.tags.split(',') : []; const includedTags = router.currentRoute.value.query.tags ? router.currentRoute.value.query.tags.split(',') : [];
const mode = router.currentRoute.value.query.mode || 'all'; const mode = router.currentRoute.value.query.mode || 'all';