load config at init
This commit is contained in:
parent
1ad9a162aa
commit
765480d197
@ -44,6 +44,7 @@ export default {
|
||||
plugins: [
|
||||
{ src: '~/plugins/axios' },
|
||||
{ src: '~/plugins/filters' },
|
||||
{ src: '~/plugins/nuxt-client-init.js', ssr: false },
|
||||
{ src: '~plugins/video.js', ssr: false },
|
||||
{ src: '~plugins/scrollbar.js', ssr: false },
|
||||
{ src: '~plugins/splitpanes.js', ssr: false },
|
||||
|
@ -213,6 +213,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
import Menu from '@/components/Menu.vue'
|
||||
|
||||
export default {
|
||||
@ -223,18 +224,8 @@ export default {
|
||||
Menu
|
||||
},
|
||||
|
||||
async asyncData ({ app, store }) {
|
||||
if (store.state.auth.isLogin) {
|
||||
await store.dispatch('config/getGuiConfig')
|
||||
await store.dispatch('config/getPlayoutConfig')
|
||||
await store.dispatch('config/getUserConfig')
|
||||
}
|
||||
|
||||
data () {
|
||||
return {
|
||||
configGui: store.state.config.configGui,
|
||||
netChoices: store.state.config.netChoices,
|
||||
configPlayout: store.state.config.configPlayout,
|
||||
configUser: store.state.config.configUser,
|
||||
oldPass: null,
|
||||
newPass: null,
|
||||
confirmPass: null,
|
||||
@ -244,8 +235,31 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
data () {
|
||||
return {
|
||||
computed: {
|
||||
...mapState('config', ['netChoices']),
|
||||
configGui: {
|
||||
get () {
|
||||
return this.$store.state.config.configGui
|
||||
},
|
||||
set (config) {
|
||||
this.$store.commit('config/UPDATE_GUI_CONFIG', config)
|
||||
}
|
||||
},
|
||||
configPlayout: {
|
||||
get () {
|
||||
return this.$store.state.config.configPlayout
|
||||
},
|
||||
set (config) {
|
||||
this.$store.commit('config/UPDATE_PLAYLOUT_CONFIG', config)
|
||||
}
|
||||
},
|
||||
configUser: {
|
||||
get () {
|
||||
return this.$store.state.config.configUser
|
||||
},
|
||||
set (config) {
|
||||
this.$store.commit('config/UPDATE_USER_CONFIG', config)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
3
ffplayout/frontend/plugins/nuxt-client-init.js
Normal file
3
ffplayout/frontend/plugins/nuxt-client-init.js
Normal file
@ -0,0 +1,3 @@
|
||||
export default async (context) => {
|
||||
await context.store.dispatch('config/nuxtClientInit', context)
|
||||
}
|
@ -25,6 +25,14 @@ export const mutations = {
|
||||
}
|
||||
|
||||
export const actions = {
|
||||
async nuxtClientInit ({ commit, dispatch, rootState }) {
|
||||
if (rootState.auth.isLogin) {
|
||||
await dispatch('getGuiConfig')
|
||||
await dispatch('getPlayoutConfig')
|
||||
await dispatch('getUserConfig')
|
||||
}
|
||||
},
|
||||
|
||||
async getGuiConfig ({ commit, state }) {
|
||||
const options = await this.$axios.options('api/player/guisettings/')
|
||||
const response = await this.$axios.get('api/player/guisettings/')
|
||||
@ -67,6 +75,7 @@ export const actions = {
|
||||
} else {
|
||||
response = await this.$axios.put(`api/player/guisettings/${obj.id}/`, stringObj)
|
||||
}
|
||||
|
||||
return response
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user