Updating stash button locally on actor and scene page.

This commit is contained in:
DebaucheryLibrarian
2021-03-20 18:12:06 +01:00
parent bb949e0a3b
commit 07643870cd
6 changed files with 60 additions and 32 deletions

View File

@@ -52,14 +52,14 @@
</h2>
<Icon
v-show="me && release.isStashed"
v-show="me && stashed"
icon="heart7"
class="stash stashed noselect"
@click="unstashScene"
/>
<Icon
v-show="me && !release.isStashed"
v-show="me && !stashed"
icon="heart8"
class="stash unstashed noselect"
@click="stashScene"
@@ -249,26 +249,36 @@ async function fetchRelease(scroll = true) {
if (scroll && this.$refs.content) {
this.$refs.content.scrollTop = 0;
}
this.stashed = this.release.isStashed;
}
async function stashScene() {
this.$store.dispatch(this.$route.name === 'movie' ? 'stashMovie' : 'stashScene', {
sceneId: this.release.id,
movieId: this.release.id,
stashId: this.$store.getters.favorites.id,
});
this.stashed = true;
this.fetchRelease(false);
try {
this.$store.dispatch(this.$route.name === 'movie' ? 'stashMovie' : 'stashScene', {
sceneId: this.release.id,
movieId: this.release.id,
stashId: this.$store.getters.favorites.id,
});
} catch (error) {
this.stashed = false;
}
}
async function unstashScene() {
this.$store.dispatch(this.$route.name === 'movie' ? 'unstashMovie' : 'unstashScene', {
sceneId: this.release.id,
movieId: this.release.id,
stashId: this.$store.getters.favorites.id,
});
this.stashed = false;
this.fetchRelease(false);
try {
this.$store.dispatch(this.$route.name === 'movie' ? 'unstashMovie' : 'unstashScene', {
sceneId: this.release.id,
movieId: this.release.id,
stashId: this.$store.getters.favorites.id,
});
} catch (error) {
this.stashed = true;
}
}
function me() {
@@ -304,6 +314,7 @@ export default {
data() {
return {
release: null,
stashed: false,
};
},
computed: {

View File

@@ -451,7 +451,7 @@ export default {
.tile.new .poster::after {
bottom: 0;
top: auto;
margin: 0 .25rem;
margin: .1rem .25rem;
}
.stash {