Commit 6231fd60 authored by jackie / Andrea Ida Malkah Klaura's avatar jackie / Andrea Ida Malkah Klaura
Browse files

Merge branch 'bugfix/auth-on-reload' into develop

parents 0401d281 3af06e50
...@@ -54,7 +54,8 @@ export default { ...@@ -54,7 +54,8 @@ export default {
} }
} }
}, },
mounted () { created () {
console.log("auth::init");
this.$store.dispatch('auth/oidcInit') this.$store.dispatch('auth/oidcInit')
}, },
methods: { methods: {
......
...@@ -94,20 +94,25 @@ export default { ...@@ -94,20 +94,25 @@ export default {
// Right after this component is set up, we want to fetch all available shows // Right after this component is set up, we want to fetch all available shows
// and the arrays for the show meta info from the AuRa steering module. // and the arrays for the show meta info from the AuRa steering module.
created () { created () {
this.$store.dispatch('shows/fetchShows', { this.$store.watch(
callback: () => { (state) => state.auth.user.steeringUser,
this.$store.dispatch('playlists/fetch', {slug: this.selectedShow.slug}) () => {
this.$refs.showSelector.updateInputSelector() this.$store.dispatch('shows/fetchShows', {
callback: () => {
this.$store.dispatch('playlists/fetch', {slug: this.selectedShow.slug})
this.$refs.showSelector.updateInputSelector()
}
})
this.$store.dispatch('shows/fetchMetaArray', {property: 'types', onlyActive: true})
this.$store.dispatch('shows/fetchMetaArray', {property: 'fundingcategories', onlyActive: true})
this.$store.dispatch('shows/fetchMetaArray', {property: 'categories'})
this.$store.dispatch('shows/fetchMetaArray', {property: 'topics'})
this.$store.dispatch('shows/fetchMetaArray', {property: 'musicfocus'})
this.$store.dispatch('shows/fetchMetaArray', {property: 'languages'})
this.$store.dispatch('shows/fetchMetaArray', {property: 'hosts'})
if (this.isSuperuser) { this.$store.dispatch('auth/fetchUsers') }
} }
}) );
this.$store.dispatch('shows/fetchMetaArray', {property: 'types', onlyActive: true})
this.$store.dispatch('shows/fetchMetaArray', {property: 'fundingcategories', onlyActive: true})
this.$store.dispatch('shows/fetchMetaArray', {property: 'categories'})
this.$store.dispatch('shows/fetchMetaArray', {property: 'topics'})
this.$store.dispatch('shows/fetchMetaArray', {property: 'musicfocus'})
this.$store.dispatch('shows/fetchMetaArray', {property: 'languages'})
this.$store.dispatch('shows/fetchMetaArray', {property: 'hosts'})
if (this.isSuperuser) { this.$store.dispatch('auth/fetchUsers') }
}, },
methods: { methods: {
......
...@@ -98,7 +98,10 @@ export default { ...@@ -98,7 +98,10 @@ export default {
}, },
computed: { computed: {
isSuperuser () { return this.$store.state.auth.user.steeringUser.is_superuser }, isSuperuser () {
const user = this.$store.state.auth.user.steeringUser;
return user && user.is_superuser;
},
loaded () { loaded () {
return { return {
shows: this.$store.state.shows.loaded.shows, shows: this.$store.state.shows.loaded.shows,
......
...@@ -186,7 +186,6 @@ const actions = { ...@@ -186,7 +186,6 @@ const actions = {
this.$log.debug(err) this.$log.debug(err)
alert('Error: could not fetch OIDC user object. See console for details.') alert('Error: could not fetch OIDC user object. See console for details.')
}) })
}, },
signinRedirect () { signinRedirect () {
......
...@@ -157,10 +157,11 @@ const mutations = { ...@@ -157,10 +157,11 @@ const mutations = {
const actions = { const actions = {
fetchShows (ctx, data) { fetchShows (ctx, data) {
const user = ctx.rootState.auth.user.steeringUser;
ctx.commit('loading', 'shows') ctx.commit('loading', 'shows')
let uri = process.env.VUE_APP_API_STEERING + 'shows' let uri = process.env.VUE_APP_API_STEERING + 'shows'
// normal users should only see their own shows, only superusers see all shows // normal users should only see their own shows, only superusers see all shows
if (!ctx.rootState.auth.user.steeringUser.is_superuser) { if (user && !user.is_superuser) {
uri += '?owner=' + ctx.rootState.auth.user.steeringUser.id uri += '?owner=' + ctx.rootState.auth.user.steeringUser.id
} }
axios.get(uri, { axios.get(uri, {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment