Skip to content
Snippets Groups Projects
Commit 308b4cd5 authored by jackie / Andrea Ida Malkah Klaura's avatar jackie / Andrea Ida Malkah Klaura
Browse files

FIX: avoid rendering issue with steeringUser prop

vue always throws a render error, even if we include a test for user.steeringUser
before comparing user.steeringUser.is_superuser.

so we moved it to the js logic and use a separat modules array for superusers
parent 40034f9d
No related branches found
No related tags found
No related merge requests found
......@@ -28,16 +28,22 @@ export default {
modules_logged_out: [
{ slug: 'home', title: 'Home' },
{ slug: 'credits', title: 'Credits' },
{ slug: 'debug', title: 'Debug' }
],
modules_logged_in: [
{ slug: 'home', title: 'Home', superusersOnly: false },
{ slug: 'shows', title: 'Shows', superusersOnly: false },
{ slug: 'files', title: 'Files & Playlists', superusersOnly: false },
{ slug: 'emissions', title: 'Emissions', superusersOnly: true },
{ slug: 'settings', title: 'Settings', superusersOnly: false },
{ slug: 'credits', title: 'Credits', superusersOnly: false },
{ slug: 'debug', title: 'Debug', superusersOnly: true }
{ slug: 'home', title: 'Home' },
{ slug: 'shows', title: 'Shows' },
{ slug: 'files', title: 'Files & Playlists' },
{ slug: 'settings', title: 'Settings' },
{ slug: 'credits', title: 'Credits' },
],
modules_logged_in_superuser : [
{ slug: 'home', title: 'Home' },
{ slug: 'shows', title: 'Shows' },
{ slug: 'files', title: 'Files & Playlists' },
{ slug: 'emissions', title: 'Emissions' },
{ slug: 'settings', title: 'Settings' },
{ slug: 'credits', title: 'Credits' },
{ slug: 'debug', title: 'Debug' }
],
user: {
name: '',
......@@ -66,8 +72,15 @@ export default {
},
computed: {
modules: function () {
if (this.user.logged_in === true) { return this.modules_logged_in }
else { return this.modules_logged_out }
if (this.user.logged_in === true) {
if (this.user.steeringUser && this.user.steeringUser.is_superuser) {
return this.modules_logged_in_superuser
} else {
return this.modules_logged_in
}
} else {
return this.modules_logged_out
}
}
},
mounted () {
......
......@@ -41,7 +41,6 @@
v-for="mod in modules"
:key="mod.slug"
:active="mod.slug === $route.name"
:disabled="mod.superusersOnly && !$parent.user.steeringUser.is_superuser"
:to="mod.slug"
>
{{ mod.title }}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment