Update:Only show podcast search page for admin or up #225

This commit is contained in:
advplyr 2022-12-08 17:56:58 -06:00
parent 379fa21571
commit b521f37ec1
2 changed files with 11 additions and 4 deletions

View file

@ -25,6 +25,9 @@ export default {
userHasPlaylists() { userHasPlaylists() {
return this.$store.state.libraries.numUserPlaylists return this.$store.state.libraries.numUserPlaylists
}, },
userIsAdminOrUp() {
return this.$store.getters['user/getIsAdminOrUp']
},
items() { items() {
let items = [] let items = []
if (this.isPodcast) { if (this.isPodcast) {
@ -52,16 +55,19 @@ export default {
icon: this.currentLibraryIcon, icon: this.currentLibraryIcon,
iconClass: 'text-lg', iconClass: 'text-lg',
text: 'Library' text: 'Library'
}, }
{ ]
if (this.userIsAdminOrUp) {
items.push({
to: '/bookshelf/search', to: '/bookshelf/search',
routeName: 'bookshelf-search', routeName: 'bookshelf-search',
iconPack: 'abs-icons', iconPack: 'abs-icons',
icon: 'podcast', icon: 'podcast',
iconClass: 'text-lg', iconClass: 'text-lg',
text: 'Search' text: 'Search'
})
} }
]
} else { } else {
items = [ items = [
{ {

View file

@ -16,6 +16,7 @@ export const state = () => ({
export const getters = { export const getters = {
getIsRoot: (state) => state.user && state.user.type === 'root', getIsRoot: (state) => state.user && state.user.type === 'root',
getIsAdminOrUp: (state) => state.user && (state.user.type === 'admin' || state.user.type === 'root'),
getToken: (state) => { getToken: (state) => {
return state.user ? state.user.token : null return state.user ? state.user.token : null
}, },