No longer reloading when stashing scene, immediately toggling heart locally and resetting on dispatch error.
This commit is contained in:
@@ -18,8 +18,6 @@
|
||||
:release="release"
|
||||
:referer="referer"
|
||||
:index="index"
|
||||
@stash="$emit('stash')"
|
||||
@unstash="$emit('unstash')"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -65,7 +63,6 @@ export default {
|
||||
default: null,
|
||||
},
|
||||
},
|
||||
emits: ['stash', 'unstash'],
|
||||
computed: {
|
||||
range,
|
||||
sfw,
|
||||
|
||||
@@ -42,14 +42,14 @@
|
||||
><Icon icon="blocked" />No thumbnail available</div>
|
||||
|
||||
<Icon
|
||||
v-show="release.isStashed"
|
||||
v-show="stashed"
|
||||
icon="heart7"
|
||||
class="stash stashed"
|
||||
@click.prevent.native="unstashScene"
|
||||
/>
|
||||
|
||||
<Icon
|
||||
v-show="release.isStashed === false"
|
||||
v-show="stashed === false"
|
||||
icon="heart8"
|
||||
class="stash unstashed"
|
||||
@click.prevent.native="stashScene"
|
||||
@@ -148,21 +148,29 @@
|
||||
import Details from './tile-details.vue';
|
||||
|
||||
async function stashScene() {
|
||||
this.$store.dispatch('stashScene', {
|
||||
sceneId: this.release.id,
|
||||
stashId: this.$store.getters.favorites.id,
|
||||
});
|
||||
this.stashed = true;
|
||||
|
||||
this.$emit('stash');
|
||||
try {
|
||||
await this.$store.dispatch('stashScene', {
|
||||
sceneId: this.release.id,
|
||||
stashId: this.$store.getters.favorites.id,
|
||||
});
|
||||
} catch (error) {
|
||||
this.stashed = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function unstashScene() {
|
||||
this.$store.dispatch('unstashScene', {
|
||||
sceneId: this.release.id,
|
||||
stashId: this.$store.getters.favorites.id,
|
||||
});
|
||||
this.stashed = false;
|
||||
|
||||
this.$emit('unstash');
|
||||
try {
|
||||
this.$store.dispatch('unstashScene', {
|
||||
sceneId: this.release.id,
|
||||
stashId: this.$store.getters.favorites.id,
|
||||
});
|
||||
} catch (error) {
|
||||
this.stashed = true;
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
@@ -175,7 +183,11 @@ export default {
|
||||
default: null,
|
||||
},
|
||||
},
|
||||
emits: ['stash', 'unstash'],
|
||||
data() {
|
||||
return {
|
||||
stashed: this.release.isStashed,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
stashScene,
|
||||
unstashScene,
|
||||
|
||||
Reference in New Issue
Block a user