Added favorites link to user menu.

This commit is contained in:
DebaucheryLibrarian 2021-09-12 00:33:24 +02:00
parent c21bd8b01e
commit 73a9a11aa6
2 changed files with 23 additions and 14 deletions

View File

@ -1,28 +1,26 @@
<template>
<div class="menu">
<ul class="menu-items noselect">
<router-link
<RouterLink
v-if="login && me"
:to="{ name: 'user', params: { username: me.username } }"
class="menu-username"
>{{ me.username }}</router-link>
>{{ me.username }}</RouterLink>
<router-link
<RouterLink
v-if="me && favorites"
:to="{ name: 'stash', params: { stashId: favorites.id, range: 'scenes', pageNumber: 1 } }"
class="menu-item"
><Icon icon="heart7" />Favorites</RouterLink>
<RouterLink
v-else-if="login"
:to="{ name: 'login', query: { ref: $route.path } }"
class="menu-item"
@click.stop
>
<Icon icon="enter2" />Log in
</router-link>
<li
v-if="login && me"
class="menu-item"
@click.stop="$store.dispatch('logout')"
>
<Icon icon="exit2" />Log out
</li>
</RouterLink>
<li
v-show="!sfw"
@ -74,6 +72,14 @@
>
<Icon icon="filter" />Filters
</li>
<li
v-if="login && me"
class="menu-item"
@click.stop="$store.dispatch('logout')"
>
<Icon icon="exit2" />Log out
</li>
</ul>
</div>
</template>
@ -97,6 +103,10 @@ function signup(state) {
return state.auth.signup;
}
function favorites() {
return this.me?.stashes.find(stash => stash.primary);
}
function me(state) {
return state.auth.user;
}
@ -118,6 +128,7 @@ export default {
theme,
me,
}),
favorites,
},
emits: ['showFilters'],
methods: {

View File

@ -114,8 +114,6 @@ async function fetchStash() {
limit: this.limit,
});
console.log(this.stash.movies);
this.isMine = this.stash.user?.id === this.$store.state.auth.user?.id;
if (this.$route.params.range === 'scenes') {