From b521f37ec1155e83bf9cb3a4c6524ebec610a56e Mon Sep 17 00:00:00 2001 From: advplyr Date: Thu, 8 Dec 2022 17:56:58 -0600 Subject: [PATCH] Update:Only show podcast search page for admin or up #225 --- components/home/BookshelfNavBar.vue | 14 ++++++++++---- store/user.js | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/components/home/BookshelfNavBar.vue b/components/home/BookshelfNavBar.vue index 3df98e14..8706236b 100644 --- a/components/home/BookshelfNavBar.vue +++ b/components/home/BookshelfNavBar.vue @@ -25,6 +25,9 @@ export default { userHasPlaylists() { return this.$store.state.libraries.numUserPlaylists }, + userIsAdminOrUp() { + return this.$store.getters['user/getIsAdminOrUp'] + }, items() { let items = [] if (this.isPodcast) { @@ -52,16 +55,19 @@ export default { icon: this.currentLibraryIcon, iconClass: 'text-lg', text: 'Library' - }, - { + } + ] + + if (this.userIsAdminOrUp) { + items.push({ to: '/bookshelf/search', routeName: 'bookshelf-search', iconPack: 'abs-icons', icon: 'podcast', iconClass: 'text-lg', text: 'Search' - } - ] + }) + } } else { items = [ { diff --git a/store/user.js b/store/user.js index 7ae96ebd..8981e557 100644 --- a/store/user.js +++ b/store/user.js @@ -16,6 +16,7 @@ export const state = () => ({ export const getters = { getIsRoot: (state) => state.user && state.user.type === 'root', + getIsAdminOrUp: (state) => state.user && (state.user.type === 'admin' || state.user.type === 'root'), getToken: (state) => { return state.user ? state.user.token : null },