forked from DebaucheryLibrarian/traxxx
Updating stash button locally on actor and scene page.
This commit is contained in:
@@ -35,14 +35,14 @@
|
||||
/>
|
||||
|
||||
<Icon
|
||||
v-show="me && isStashed"
|
||||
v-show="me && stashed"
|
||||
icon="heart7"
|
||||
class="stash stashed noselect"
|
||||
@click="unstashActor"
|
||||
/>
|
||||
|
||||
<Icon
|
||||
v-show="me && !isStashed"
|
||||
v-show="me && !stashed"
|
||||
icon="heart8"
|
||||
class="stash unstashed noselect"
|
||||
@click="stashActor"
|
||||
@@ -402,6 +402,7 @@ async function fetchActor(scroll = true) {
|
||||
this.actor = actor;
|
||||
this.releases = releases;
|
||||
this.totalCount = totalCount;
|
||||
this.stashed = this.actor.isStashed;
|
||||
|
||||
if (this.$refs.filter && scroll) {
|
||||
this.$refs.filter.$el.scrollIntoView();
|
||||
@@ -409,31 +410,35 @@ async function fetchActor(scroll = true) {
|
||||
}
|
||||
|
||||
async function stashActor() {
|
||||
this.$store.dispatch('stashActor', {
|
||||
actorId: this.actor.id,
|
||||
stashId: this.$store.getters.favorites.id,
|
||||
});
|
||||
this.stashed = true;
|
||||
|
||||
this.fetchActor(false);
|
||||
try {
|
||||
this.$store.dispatch('stashActor', {
|
||||
actorId: this.actor.id,
|
||||
stashId: this.$store.getters.favorites.id,
|
||||
});
|
||||
} catch (error) {
|
||||
this.stashed = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function unstashActor() {
|
||||
this.$store.dispatch('unstashActor', {
|
||||
actorId: this.actor.id,
|
||||
stashId: this.$store.getters.favorites.id,
|
||||
});
|
||||
this.stashed = false;
|
||||
|
||||
this.fetchActor(false);
|
||||
try {
|
||||
this.$store.dispatch('unstashActor', {
|
||||
actorId: this.actor.id,
|
||||
stashId: this.$store.getters.favorites.id,
|
||||
});
|
||||
} catch (error) {
|
||||
this.stashed = true;
|
||||
}
|
||||
}
|
||||
|
||||
function me() {
|
||||
return this.$store.state.auth.user;
|
||||
}
|
||||
|
||||
function isStashed() {
|
||||
return this.actor.stashes?.length > 0;
|
||||
}
|
||||
|
||||
function sfw() {
|
||||
return this.$store.state.ui.sfw;
|
||||
}
|
||||
@@ -477,10 +482,10 @@ export default {
|
||||
pageTitle: null,
|
||||
bioExpanded: false,
|
||||
photosExpanded: false,
|
||||
stashed: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
isStashed,
|
||||
me,
|
||||
sfw,
|
||||
showAlbum,
|
||||
|
||||
Reference in New Issue
Block a user