Refactored http timeout handling.

This commit is contained in:
DebaucheryLibrarian
2021-03-17 02:09:34 +01:00
parent 36a8adbd8c
commit 336b91c872
9 changed files with 147 additions and 72 deletions

View File

@@ -50,6 +50,20 @@
icon="question2"
/>
</h2>
<Icon
v-show="me && isStashed"
icon="heart7"
class="stash stashed noselect"
@click="unstashScene"
/>
<Icon
v-show="me && !isStashed"
icon="heart8"
class="stash unstashed noselect"
@click="stashScene"
/>
</div>
<div class="row associations">
@@ -223,7 +237,7 @@ import Actor from '../actors/tile.vue';
import Releases from './releases.vue';
import Scroll from '../scroll/scroll.vue';
async function fetchRelease() {
async function fetchRelease(scroll = true) {
if (this.$route.name === 'scene') {
this.release = await this.$store.dispatch('fetchReleaseById', this.$route.params.releaseId);
}
@@ -232,11 +246,37 @@ async function fetchRelease() {
this.release = await this.$store.dispatch('fetchMovieById', this.$route.params.releaseId);
}
if (this.$refs.content) {
if (scroll && this.$refs.content) {
this.$refs.content.scrollTop = 0;
}
}
async function stashScene() {
this.$store.dispatch('stashScene', {
sceneId: this.release.id,
stashId: this.$store.getters.favorites.id,
});
this.fetchRelease(false);
}
async function unstashScene() {
this.$store.dispatch('unstashScene', {
sceneId: this.release.id,
stashId: this.$store.getters.favorites.id,
});
this.fetchRelease(false);
}
function me() {
return this.$store.state.auth.user;
}
function isStashed() {
return this.release.stashes?.length > 0;
}
function bannerBackground() {
return (this.release.poster && this.getBgPath(this.release.poster, 'thumbnail'))
|| (this.release.covers.length > 0 && this.getBgPath(this.release.covers[0], 'thumbnail'));
@@ -271,6 +311,8 @@ export default {
computed: {
pageTitle,
bannerBackground,
isStashed,
me,
showAlbum,
},
watch: {
@@ -279,6 +321,8 @@ export default {
mounted: fetchRelease,
methods: {
fetchRelease,
stashScene,
unstashScene,
},
};
</script>
@@ -353,6 +397,22 @@ export default {
color: var(--shadow);
}
.stash.icon {
width: 1.5rem;
height: 1.5rem;
padding: 0 1rem;
fill: var(--darken);
&.stashed {
fill: var(--primary);
}
&:hover {
fill: var(--primary);
cursor: pointer;
}
}
.album-toggle {
height: fit-content;
display: inline-flex;