Fix sidewards-compability
Bei der Sidewards-compability wurde durch das umschreiben die Gruppen des Nutzers nicht mehr richtig gespeichert. Dieser Fehler wurde behoben.
This commit is contained in:
parent
c379656f3e
commit
b92a94adb0
|
@ -8,7 +8,7 @@ const state = {
|
|||
firstname: null,
|
||||
lastname: null,
|
||||
accessToken: null,
|
||||
group: null
|
||||
groups: null
|
||||
},
|
||||
loggingIn: false,
|
||||
loginError: null,
|
||||
|
@ -30,11 +30,11 @@ const mutations = {
|
|||
if (data === null || data === undefined) {
|
||||
state.user.username = null
|
||||
state.user.accessToken = null
|
||||
state.user.group = null
|
||||
state.user.groups = null
|
||||
} else {
|
||||
state.user.username = data.username
|
||||
state.user.accessToken = data.accessToken
|
||||
state.user.group = data.groups
|
||||
state.user.groups = data.groups
|
||||
state.user.firstname = data.firstname
|
||||
state.user.lastname = data.lastname
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ const mutations = {
|
|||
logout(state) {
|
||||
state.user.accessToken = null
|
||||
state.user.username = null
|
||||
state.user.group = null
|
||||
state.user.groups = null
|
||||
state.user.firstname = null
|
||||
state.user.lastname = null
|
||||
},
|
||||
|
@ -74,18 +74,18 @@ const actions = {
|
|||
JSON.stringify({
|
||||
username: response.data.username,
|
||||
accessToken: response.data.accessToken,
|
||||
group: response.data.groups,
|
||||
groups: response.data.groups,
|
||||
firstname: response.data.firstname,
|
||||
lastname: response.data.lastname
|
||||
})
|
||||
)
|
||||
commit('loginStop', null)
|
||||
commit('updateAccessToken', response.data)
|
||||
if (state.user.group.includes('bar')) {
|
||||
if (state.user.groups.includes('bar')) {
|
||||
router.push('/main/bar/geruecht')
|
||||
} else if (state.user.group.includes('user')) {
|
||||
} else if (state.user.groups.includes('user')) {
|
||||
router.push('/main/user/add')
|
||||
} else if (state.user.group.includes('extern')) {
|
||||
} else if (state.user.groups.includes('extern')) {
|
||||
router.push('/main')
|
||||
}
|
||||
} catch (err) {
|
||||
|
@ -96,7 +96,7 @@ const actions = {
|
|||
commit('updateAccessToken', {
|
||||
username: null,
|
||||
accessToken: null,
|
||||
group: null,
|
||||
groups: null,
|
||||
firstname: null,
|
||||
lastname: null
|
||||
})
|
||||
|
@ -162,7 +162,7 @@ const actions = {
|
|||
})
|
||||
commit('setLifetime', response.data.value)
|
||||
var user = JSON.parse(localStorage.getItem('user'))
|
||||
user.group = response.data.groups
|
||||
user.groups = response.data.groups
|
||||
localStorage.setItem('user', JSON.stringify(user))
|
||||
commit('updateAccessToken', user)
|
||||
dispatch('barUsers/setLockStatus', response.data.lock_bar, {
|
||||
|
@ -183,10 +183,10 @@ const getters = {
|
|||
return state.loggingIn
|
||||
},
|
||||
getGroup: state => {
|
||||
return state.user.group
|
||||
return state.user.groups
|
||||
},
|
||||
group: state => {
|
||||
return state.user.group
|
||||
return state.user.groups
|
||||
},
|
||||
getToken: state => {
|
||||
return state.user.accessToken
|
||||
|
@ -199,35 +199,35 @@ const getters = {
|
|||
},
|
||||
isBar: state => {
|
||||
try {
|
||||
return state.user.group.includes('bar')
|
||||
return state.user.groups.includes('bar')
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
},
|
||||
isFinanzer: state => {
|
||||
try {
|
||||
return state.user.group.includes('moneymaster')
|
||||
return state.user.groups.includes('moneymaster')
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
},
|
||||
isUser: state => {
|
||||
try {
|
||||
return state.user.group.includes('user')
|
||||
return state.user.groups.includes('user')
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
},
|
||||
isGastro: state => {
|
||||
try {
|
||||
return state.user.group.includes('gastro')
|
||||
return state.user.groups.includes('gastro')
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
},
|
||||
isExtern: state => {
|
||||
try {
|
||||
return state.user.group.includes('extern')
|
||||
return state.user.groups.includes('extern')
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
|
@ -235,9 +235,9 @@ const getters = {
|
|||
isManagement: state => {
|
||||
try {
|
||||
return (
|
||||
state.user.group.includes('vorstand') ||
|
||||
state.user.group.includes('gastro') ||
|
||||
state.user.group.includes('moneymaster')
|
||||
state.user.groups.includes('vorstand') ||
|
||||
state.user.groups.includes('gastro') ||
|
||||
state.user.groups.includes('moneymaster')
|
||||
)
|
||||
} catch (e) {
|
||||
return false
|
||||
|
|
Loading…
Reference in New Issue