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,
|
firstname: null,
|
||||||
lastname: null,
|
lastname: null,
|
||||||
accessToken: null,
|
accessToken: null,
|
||||||
group: null
|
groups: null
|
||||||
},
|
},
|
||||||
loggingIn: false,
|
loggingIn: false,
|
||||||
loginError: null,
|
loginError: null,
|
||||||
|
@ -30,11 +30,11 @@ const mutations = {
|
||||||
if (data === null || data === undefined) {
|
if (data === null || data === undefined) {
|
||||||
state.user.username = null
|
state.user.username = null
|
||||||
state.user.accessToken = null
|
state.user.accessToken = null
|
||||||
state.user.group = null
|
state.user.groups = null
|
||||||
} else {
|
} else {
|
||||||
state.user.username = data.username
|
state.user.username = data.username
|
||||||
state.user.accessToken = data.accessToken
|
state.user.accessToken = data.accessToken
|
||||||
state.user.group = data.groups
|
state.user.groups = data.groups
|
||||||
state.user.firstname = data.firstname
|
state.user.firstname = data.firstname
|
||||||
state.user.lastname = data.lastname
|
state.user.lastname = data.lastname
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ const mutations = {
|
||||||
logout(state) {
|
logout(state) {
|
||||||
state.user.accessToken = null
|
state.user.accessToken = null
|
||||||
state.user.username = null
|
state.user.username = null
|
||||||
state.user.group = null
|
state.user.groups = null
|
||||||
state.user.firstname = null
|
state.user.firstname = null
|
||||||
state.user.lastname = null
|
state.user.lastname = null
|
||||||
},
|
},
|
||||||
|
@ -74,18 +74,18 @@ const actions = {
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
username: response.data.username,
|
username: response.data.username,
|
||||||
accessToken: response.data.accessToken,
|
accessToken: response.data.accessToken,
|
||||||
group: response.data.groups,
|
groups: response.data.groups,
|
||||||
firstname: response.data.firstname,
|
firstname: response.data.firstname,
|
||||||
lastname: response.data.lastname
|
lastname: response.data.lastname
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
commit('loginStop', null)
|
commit('loginStop', null)
|
||||||
commit('updateAccessToken', response.data)
|
commit('updateAccessToken', response.data)
|
||||||
if (state.user.group.includes('bar')) {
|
if (state.user.groups.includes('bar')) {
|
||||||
router.push('/main/bar/geruecht')
|
router.push('/main/bar/geruecht')
|
||||||
} else if (state.user.group.includes('user')) {
|
} else if (state.user.groups.includes('user')) {
|
||||||
router.push('/main/user/add')
|
router.push('/main/user/add')
|
||||||
} else if (state.user.group.includes('extern')) {
|
} else if (state.user.groups.includes('extern')) {
|
||||||
router.push('/main')
|
router.push('/main')
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -96,7 +96,7 @@ const actions = {
|
||||||
commit('updateAccessToken', {
|
commit('updateAccessToken', {
|
||||||
username: null,
|
username: null,
|
||||||
accessToken: null,
|
accessToken: null,
|
||||||
group: null,
|
groups: null,
|
||||||
firstname: null,
|
firstname: null,
|
||||||
lastname: null
|
lastname: null
|
||||||
})
|
})
|
||||||
|
@ -162,7 +162,7 @@ const actions = {
|
||||||
})
|
})
|
||||||
commit('setLifetime', response.data.value)
|
commit('setLifetime', response.data.value)
|
||||||
var user = JSON.parse(localStorage.getItem('user'))
|
var user = JSON.parse(localStorage.getItem('user'))
|
||||||
user.group = response.data.groups
|
user.groups = response.data.groups
|
||||||
localStorage.setItem('user', JSON.stringify(user))
|
localStorage.setItem('user', JSON.stringify(user))
|
||||||
commit('updateAccessToken', user)
|
commit('updateAccessToken', user)
|
||||||
dispatch('barUsers/setLockStatus', response.data.lock_bar, {
|
dispatch('barUsers/setLockStatus', response.data.lock_bar, {
|
||||||
|
@ -183,10 +183,10 @@ const getters = {
|
||||||
return state.loggingIn
|
return state.loggingIn
|
||||||
},
|
},
|
||||||
getGroup: state => {
|
getGroup: state => {
|
||||||
return state.user.group
|
return state.user.groups
|
||||||
},
|
},
|
||||||
group: state => {
|
group: state => {
|
||||||
return state.user.group
|
return state.user.groups
|
||||||
},
|
},
|
||||||
getToken: state => {
|
getToken: state => {
|
||||||
return state.user.accessToken
|
return state.user.accessToken
|
||||||
|
@ -199,35 +199,35 @@ const getters = {
|
||||||
},
|
},
|
||||||
isBar: state => {
|
isBar: state => {
|
||||||
try {
|
try {
|
||||||
return state.user.group.includes('bar')
|
return state.user.groups.includes('bar')
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isFinanzer: state => {
|
isFinanzer: state => {
|
||||||
try {
|
try {
|
||||||
return state.user.group.includes('moneymaster')
|
return state.user.groups.includes('moneymaster')
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isUser: state => {
|
isUser: state => {
|
||||||
try {
|
try {
|
||||||
return state.user.group.includes('user')
|
return state.user.groups.includes('user')
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isGastro: state => {
|
isGastro: state => {
|
||||||
try {
|
try {
|
||||||
return state.user.group.includes('gastro')
|
return state.user.groups.includes('gastro')
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isExtern: state => {
|
isExtern: state => {
|
||||||
try {
|
try {
|
||||||
return state.user.group.includes('extern')
|
return state.user.groups.includes('extern')
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -235,9 +235,9 @@ const getters = {
|
||||||
isManagement: state => {
|
isManagement: state => {
|
||||||
try {
|
try {
|
||||||
return (
|
return (
|
||||||
state.user.group.includes('vorstand') ||
|
state.user.groups.includes('vorstand') ||
|
||||||
state.user.group.includes('gastro') ||
|
state.user.groups.includes('gastro') ||
|
||||||
state.user.group.includes('moneymaster')
|
state.user.groups.includes('moneymaster')
|
||||||
)
|
)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Reference in New Issue