No longer reloading when stashing scene, immediately toggling heart locally and resetting on dispatch error.

This commit is contained in:
DebaucheryLibrarian 2021-03-20 00:41:21 +01:00
parent d0e987a2aa
commit 011f10fba8
7 changed files with 37 additions and 36 deletions

View File

@ -365,11 +365,7 @@
:available-actors="actor.actors" :available-actors="actor.actors"
/> />
<Releases <Releases :releases="releases" />
:releases="releases"
@stash="fetchActor(false)"
@unstash="fetchActor(false)"
/>
<Pagination <Pagination
:items-total="totalCount" :items-total="totalCount"

View File

@ -99,11 +99,7 @@
/> />
<div class="releases"> <div class="releases">
<Releases <Releases :releases="entity.releases" />
:releases="entity.releases"
@stash="fetchEntity(false)"
@unstash="fetchEntity(false)"
/>
<Pagination <Pagination
:items-total="totalCount" :items-total="totalCount"

View File

@ -10,11 +10,7 @@
:content="$refs.content" :content="$refs.content"
/> />
<Releases <Releases :releases="releases" />
:releases="releases"
@stash="fetchReleases(false)"
@unstash="fetchReleases(false)"
/>
<Pagination <Pagination
v-if="totalCount > 0" v-if="totalCount > 0"

View File

@ -18,8 +18,6 @@
:release="release" :release="release"
:referer="referer" :referer="referer"
:index="index" :index="index"
@stash="$emit('stash')"
@unstash="$emit('unstash')"
/> />
</li> </li>
</ul> </ul>
@ -65,7 +63,6 @@ export default {
default: null, default: null,
}, },
}, },
emits: ['stash', 'unstash'],
computed: { computed: {
range, range,
sfw, sfw,

View File

@ -42,14 +42,14 @@
><Icon icon="blocked" />No thumbnail available</div> ><Icon icon="blocked" />No thumbnail available</div>
<Icon <Icon
v-show="release.isStashed" v-show="stashed"
icon="heart7" icon="heart7"
class="stash stashed" class="stash stashed"
@click.prevent.native="unstashScene" @click.prevent.native="unstashScene"
/> />
<Icon <Icon
v-show="release.isStashed === false" v-show="stashed === false"
icon="heart8" icon="heart8"
class="stash unstashed" class="stash unstashed"
@click.prevent.native="stashScene" @click.prevent.native="stashScene"
@ -148,21 +148,29 @@
import Details from './tile-details.vue'; import Details from './tile-details.vue';
async function stashScene() { async function stashScene() {
this.$store.dispatch('stashScene', { this.stashed = true;
try {
await this.$store.dispatch('stashScene', {
sceneId: this.release.id, sceneId: this.release.id,
stashId: this.$store.getters.favorites.id, stashId: this.$store.getters.favorites.id,
}); });
} catch (error) {
this.$emit('stash'); this.stashed = false;
}
} }
async function unstashScene() { async function unstashScene() {
this.stashed = false;
try {
this.$store.dispatch('unstashScene', { this.$store.dispatch('unstashScene', {
sceneId: this.release.id, sceneId: this.release.id,
stashId: this.$store.getters.favorites.id, stashId: this.$store.getters.favorites.id,
}); });
} catch (error) {
this.$emit('unstash'); this.stashed = true;
}
} }
export default { export default {
@ -175,7 +183,11 @@ export default {
default: null, default: null,
}, },
}, },
emits: ['stash', 'unstash'], data() {
return {
stashed: this.release.isStashed,
};
},
methods: { methods: {
stashScene, stashScene,
unstashScene, unstashScene,

View File

@ -49,11 +49,7 @@
:fetch-releases="fetchReleases" :fetch-releases="fetchReleases"
/> />
<Releases <Releases :releases="releases" />
:releases="releases"
@stash="fetchReleases(false)"
@unstash="fetchReleases(false)"
/>
<Pagination <Pagination
:items-total="totalCount" :items-total="totalCount"

View File

@ -99,6 +99,8 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import 'breakpoints';
.header { .header {
padding: .5rem 1rem; padding: .5rem 1rem;
background: var(--profile); background: var(--profile);
@ -174,4 +176,10 @@ export default {
.stash-scene { .stash-scene {
flex-shrink: 0; flex-shrink: 0;
} }
@media(max-width: $breakpoint-kilo) {
.stashes {
grid-template-columns: 1fr;
}
}
</style> </style>