fix auth (#24), update deps, local user_locale

This commit is contained in:
les
2019-09-17 16:05:46 +02:00
parent 5f94f72912
commit 46bc1854de
7 changed files with 36 additions and 33 deletions

View File

@@ -4,6 +4,7 @@ import find from 'lodash/find'
export const state = () => ({
locale: '',
user_locale: {},
events: [],
tags: [],
places: [],
@@ -137,10 +138,14 @@ export const mutations = {
export const actions = {
// this method is called server side only for each request
// we use it to get configuration from db, setting locale, etc...
async nuxtServerInit ({ commit }, { app, req }) {
async nuxtServerInit ({ commit }, { app, store, req }) {
const settings = await app.$axios.$get('/settings')
commit('setSettings', settings)
// check if we could retrieve it directly?
const user_locale = await app.$axios.$get('/settings/user_locale')
if (user_locale[store.state.locale]) { store.commit('setUserLocale', user_locale[store.state.locale]) }
// apply settings
commit('showRecurrentEvents', settings.allow_recurrent_event && settings.recurrent_event_visible)
},