Merge branch 'feature/status' into develop

This commit is contained in:
Tim Gröger 2020-03-03 23:34:13 +01:00
commit c1d058f8c5
11 changed files with 569 additions and 51 deletions

View File

@ -64,7 +64,7 @@
<v-row> <v-row>
<v-col cols="10"> <v-col cols="10">
<v-row> <v-row>
<v-col> <v-col cols="6" xs="5" sm="4">
<v-btn <v-btn
class="creditBtn" class="creditBtn"
block block
@ -77,10 +77,10 @@
" "
:color="color" :color="color"
:disabled="user.locked" :disabled="user.locked"
>2 </v-btn >2
> </v-btn>
</v-col> </v-col>
<v-col> <v-col cols="6" xs="5" sm="4">
<v-btn <v-btn
class="creditBtn" class="creditBtn"
block block
@ -93,10 +93,10 @@
" "
:color="color" :color="color"
:disabled="user.locked" :disabled="user.locked"
>1 </v-btn >1
> </v-btn>
</v-col> </v-col>
<v-col> <v-col cols="6" xs="5" sm="4">
<v-btn <v-btn
class="creditBtn" class="creditBtn"
block block
@ -109,12 +109,10 @@
" "
:color="color" :color="color"
:disabled="user.locked" :disabled="user.locked"
>0,50 </v-btn >0,50
> </v-btn>
</v-col> </v-col>
</v-row> <v-col cols="6" xs="5" sm="4">
<v-row>
<v-col>
<v-btn <v-btn
class="creditBtn" class="creditBtn"
block block
@ -127,10 +125,10 @@
" "
:color="color" :color="color"
:disabled="user.locked" :disabled="user.locked"
>0,40 </v-btn >0,40
> </v-btn>
</v-col> </v-col>
<v-col> <v-col cols="6" xs="5" sm="4">
<v-btn <v-btn
class="creditBtn" class="creditBtn"
block block
@ -143,10 +141,10 @@
" "
:color="color" :color="color"
:disabled="user.locked" :disabled="user.locked"
>0,20 </v-btn >0,20
> </v-btn>
</v-col> </v-col>
<v-col> <v-col cols="6" xs="5" sm="4">
<v-btn <v-btn
class="creditBtn" class="creditBtn"
block block
@ -159,8 +157,16 @@
" "
:color="color" :color="color"
:disabled="user.locked" :disabled="user.locked"
>0,10 </v-btn >0,10
> </v-btn>
</v-col>
<v-col cols="8">
<v-text-field outlined type="number" v-model="user.value" label="Benutzerdefinierter Betrag" :disabled="user.locked"></v-text-field>
</v-col>
<v-col cols="4">
<v-btn fab :color="color" @click="addAmountMore(user)" :disabled="user.locked">
<v-icon>{{plus}}</v-icon>
</v-btn>
</v-col> </v-col>
</v-row> </v-row>
</v-col> </v-col>
@ -203,6 +209,7 @@
<script> <script>
import { mapGetters, mapActions } from 'vuex' import { mapGetters, mapActions } from 'vuex'
import {mdiPlus} from '@mdi/js'
import AddAmountSkeleton from '../user/Skeleton/AddAmountSkeleton' import AddAmountSkeleton from '../user/Skeleton/AddAmountSkeleton'
export default { export default {
@ -211,6 +218,8 @@ export default {
props: {}, props: {},
data() { data() {
return { return {
plus: mdiPlus,
value: null,
color: 'green accent-4', color: 'green accent-4',
menu: true, menu: true,
dialog: false, dialog: false,
@ -246,6 +255,12 @@ export default {
return true return true
} }
}, },
addAmountMore(user) {
this.addAmount({username: user.username, amount: user.value * 100, user: user})
setTimeout(() => {
user.value = null
}, 300)
},
storno(message) { storno(message) {
console.log('storno') console.log('storno')
if (!message.error) { if (!message.error) {

View File

@ -60,7 +60,7 @@
<v-row> <v-row>
<v-col cols="10"> <v-col cols="10">
<v-row> <v-row>
<v-col> <v-col cols="6" sm="4">
<v-btn <v-btn
class="creditBtn" class="creditBtn"
block block
@ -70,7 +70,7 @@
>2 </v-btn >2 </v-btn
> >
</v-col> </v-col>
<v-col> <v-col cols="6" sm="4">
<v-btn <v-btn
class="creditBtn" class="creditBtn"
block block
@ -80,7 +80,7 @@
>1 </v-btn >1 </v-btn
> >
</v-col> </v-col>
<v-col> <v-col cols="6" sm="4">
<v-btn <v-btn
class="creditBtn" class="creditBtn"
block block
@ -90,9 +90,7 @@
>0,50 </v-btn >0,50 </v-btn
> >
</v-col> </v-col>
</v-row> <v-col cols="6" sm="4">
<v-row>
<v-col>
<v-btn <v-btn
class="creditBtn" class="creditBtn"
block block
@ -102,7 +100,7 @@
>0,40 </v-btn >0,40 </v-btn
> >
</v-col> </v-col>
<v-col> <v-col cols="6" sm="4">
<v-btn <v-btn
class="creditBtn" class="creditBtn"
block block
@ -112,7 +110,7 @@
>0,20 </v-btn >0,20 </v-btn
> >
</v-col> </v-col>
<v-col> <v-col cols="6" sm="4">
<v-btn <v-btn
class="creditBtn" class="creditBtn"
block block
@ -122,6 +120,14 @@
>0,10 </v-btn >0,10 </v-btn
> >
</v-col> </v-col>
<v-col cols="8">
<v-text-field outlined type="number" v-model="value" label="Benutzerdefinierter Betrag" :disabled="user.locked"></v-text-field>
</v-col>
<v-col cols="4">
<v-btn fab :color="color" @click="addAmountMore()" :disabled="user.locked">
<v-icon>{{plus}}</v-icon>
</v-btn>
</v-col>
</v-row> </v-row>
</v-col> </v-col>
<v-col align-self="center"> <v-col align-self="center">
@ -160,7 +166,7 @@
<script> <script>
import { mapGetters, mapActions } from 'vuex' import { mapGetters, mapActions } from 'vuex'
import { mdiMenu } from '@mdi/js' import { mdiMenu, mdiPlus } from '@mdi/js'
import AddAmountSkeleton from './Skeleton/AddAmountSkeleton' import AddAmountSkeleton from './Skeleton/AddAmountSkeleton'
export default { export default {
name: 'AddAmount', name: 'AddAmount',
@ -168,6 +174,8 @@ export default {
data() { data() {
return { return {
color: 'green accent-4', color: 'green accent-4',
value: null,
plus: mdiPlus,
menu: false, menu: false,
dialog: false, dialog: false,
componentRenderer: 0, componentRenderer: 0,
@ -209,6 +217,12 @@ export default {
}) })
} }
} }
},
addAmountMore() {
this.addAmount(this.value * 100)
setTimeout(() => {
this.value = null
}, 300)
} }
}, },
computed: { computed: {

View File

@ -116,18 +116,26 @@
append-icon append-icon
> >
<template v-slot:selection="data"> <template v-slot:selection="data">
<v-icon>{{ <v-icon class="ma-2">{{
data.item === 'user' data.item === 'user'
? person ? person
: data.item === 'bar' : data.item === 'bar'
? bar ? bar
: data.item === 'moneymaster' : data.item === 'moneymaster'
? finanzer ? finanzer
: false : data.item === 'gastro'
? gastro
: ''
}}</v-icon> }}</v-icon>
</template> </template>
</v-combobox> </v-combobox>
</v-col> </v-col>
<v-col>
<v-text-field outlined :value="computeStatus" readonly label="Mitgliedsstatus"/>
</v-col>
<v-col>
<v-text-field outlined :value="user.voting ? 'ja' : 'nein'" readonly label="Stimmrecht" />
</v-col>
</v-row> </v-row>
</v-card-text> </v-card-text>
<v-card-actions> <v-card-actions>
@ -142,7 +150,12 @@
</template> </template>
<script> <script>
import { mdiAccount, mdiGlassCocktail, mdiCurrencyEur } from '@mdi/js' import {
mdiAccount,
mdiGlassCocktail,
mdiCurrencyEur,
mdiFoodForkDrink
} from '@mdi/js'
import { mapGetters, mapActions } from 'vuex' import { mapGetters, mapActions } from 'vuex'
export default { export default {
name: 'Config', name: 'Config',
@ -151,6 +164,7 @@ export default {
person: mdiAccount, person: mdiAccount,
bar: mdiGlassCocktail, bar: mdiGlassCocktail,
finanzer: mdiCurrencyEur, finanzer: mdiCurrencyEur,
gastro: mdiFoodForkDrink,
username: null, username: null,
mail: null, mail: null,
firstname: null, firstname: null,
@ -160,8 +174,8 @@ export default {
this.password === value || 'Passwörter sind nicht identisch.', this.password === value || 'Passwörter sind nicht identisch.',
email: value => { email: value => {
if (value.length > 0) { if (value.length > 0) {
const pattern = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; const pattern = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
return pattern.test(value) || 'keine gültige E-Mail'; return pattern.test(value) || 'keine gültige E-Mail'
} }
return true return true
} }
@ -169,7 +183,8 @@ export default {
}, },
methods: { methods: {
...mapActions({ ...mapActions({
saveConfig: 'user/saveConfig' saveConfig: 'user/saveConfig',
getStatus: 'user/getStatus'
}), }),
save() { save() {
let user = {} let user = {}
@ -189,7 +204,8 @@ export default {
...mapGetters({ ...mapGetters({
user: 'user/user', user: 'user/user',
error: 'user/error', error: 'user/error',
loading: 'user/loading' loading: 'user/loading',
status: 'user/status'
}), }),
lock() { lock() {
return this.user.locked ? 'gesperrt' : 'nicht gesperrt' return this.user.locked ? 'gesperrt' : 'nicht gesperrt'
@ -202,7 +218,13 @@ export default {
}, },
autoLockColor() { autoLockColor() {
return this.user.autoLock ? 'green' : 'red' return this.user.autoLock ? 'green' : 'red'
},
computeStatus() {
return this.status.find(a => a.id == this.user.statusgroup).name
} }
},
created() {
this.getStatus()
} }
} }
</script> </script>

View File

@ -8,16 +8,25 @@
Dienstverwaltung Dienstverwaltung
</v-list-item-title> </v-list-item-title>
</v-list-item> </v-list-item>
<v-list-item link to="/main/management/usermanager">
<v-list-item-icon>
<v-icon>{{list}}</v-icon>
</v-list-item-icon>
<v-list-item-title>
Benutzerliste
</v-list-item-title>
</v-list-item>
</v-list> </v-list>
</template> </template>
<script> <script>
import { mdiBriefcase } from '@mdi/js' import { mdiBriefcase, mdiAccountMultiple } from '@mdi/js'
export default { export default {
name: 'ManagementNavigation', name: 'ManagementNavigation',
data() { data() {
return { return {
work: mdiBriefcase work: mdiBriefcase,
list: mdiAccountMultiple
} }
} }
} }

View File

@ -0,0 +1,244 @@
<template>
<div>
<v-dialog v-model="editUser">
<v-card>
<v-card-title>
{{
this.editedItem.firstname +
' ' +
this.editedItem.lastname +
' bearbeiten'
}}
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col>
<v-autocomplete
v-model="editedItem.statusgroup"
label="Status"
outlined
:items="status"
item-value="id"
item-text="name"
return-object
@change="clickItem(editedItem.statusgroup)"
>
</v-autocomplete>
</v-col>
<v-col>
<v-autocomplete
v-model="editedItem.voting"
label="Stimmrecht"
outlined
:items="[
{ value: true, text: 'ja' },
{ value: false, text: 'nein' }
]"
item-text="text"
item-value="value"
:disabled="disableVoting"
return-object
/>
</v-col>
</v-row>
</v-container>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn color="primary" text @click="close()">Abbrechen</v-btn>
<v-btn color="primary" text @click="save()">Speichern</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-data-table :headers="header" :items="users" :search="search">
<template v-slot:top>
<v-toolbar flat color="white">
<v-toolbar-title>Mitgliederliste</v-toolbar-title>
<v-spacer></v-spacer>
<v-text-field
v-model="search"
label="Sucher Mitglied"
single-line
hide-details
>
<template v-slot:append>
<v-icon>{{ searchIcon }}</v-icon>
</template>
</v-text-field>
</v-toolbar>
</template>
<template v-slot:item.statusgroup="{ item }">
{{ computeStatus(item.statusgroup) }}
</template>
<template v-slot:item.voting="{ item }">
<v-chip small :color="item.voting ? 'green' : 'red'">
{{ item.voting ? 'ja' : 'nein' }}
</v-chip>
</template>
<template v-slot:item.actions="{ item }">
<v-icon small @click="editItem(item)">{{ editIcon }}</v-icon>
</template>
</v-data-table>
<v-divider />
<v-card>
<v-card-text>
<v-container>
<v-row>
<v-col>
<v-text-field
outlined
:value="users.length"
label="Anzahl aller Mitglieder"
readonly
/>
</v-col>
<v-col>
<v-text-field
outlined
:value="allVotings"
label="Anzahl aller Stimmberechtigten"
readonly
/>
</v-col>
</v-row>
</v-container>
</v-card-text>
</v-card>
</div>
</template>
<script>
import { mdiPencil, mdiMagnify, } from '@mdi/js'
import { mapActions, mapGetters } from 'vuex'
export default {
name: 'UserManager',
data() {
return {
editIcon: mdiPencil,
searchIcon: mdiMagnify,
editUser: false,
disableVoting: null,
search: null,
header: [
{ text: 'Nachname', value: 'lastname' },
{ text: 'Vorname(n)', value: 'firstname' },
{ text: 'Status', value: 'statusgroup' },
{ text: 'Stimmrecht', value: 'voting' },
{
text: 'Aktionen',
value: 'actions',
sortable: false,
filterable: false
}
],
editedItem: {
id: -1,
firstname: null,
lastname: null,
username: null,
statusgroup: {
id: -1,
name: null
},
voting: {
value: false,
text: 'nein'
}
},
defaultItem: {
id: -1,
username: null,
statusgroup: {
id: -1,
name: null
},
voting: {
value: false,
text: 'nein'
}
}
}
},
methods: {
...mapActions({
getUsers: 'usermanager/getUsers',
getStatus: 'usermanager/getStatus',
updateStatusUser: 'usermanager/updateStatusUser',
updateVoting: 'usermanager/updateVoting'
}),
close() {
this.editUser = false
setTimeout(() => {
this.editedItem = Object.assign({}, this.defaultItem)
}, 300)
},
editItem(item) {
console.log('item', item)
this.editedItem = Object.assign({}, item)
console.log(this.editedItem)
this.editedItem.statusgroup = Object.assign(
{},
this.status.find(a => a.id == item.statusgroup)
)
this.editedItem.voting = Object.assign({},
item.voting ? {value: true, text: 'ja'} : {value: false, text: 'nein'})
this.clickItem(this.editedItem.statusgroup)
console.log(this.editedItem)
this.editUser = true
},
clickItem(item) {
switch (item.id) {
case 1:
this.editedItem.voting = { value: true, text: 'ja' }
this.disableVoting = true
break
case 2:
this.disableVoting = false
break
case 3:
this.disableVoting = true
this.editedItem.voting = { value: false, text: 'nein' }
break
case 4:
this.editedItem.voting = { value: false, text: 'nein' }
this.disableVoting = true
break
case 5:
this.editedItem.voting = { value: false, text: 'nein' }
this.disableVoting = true
break
}
},
save() {
this.updateStatusUser({username: this.editedItem.username, status: this.editedItem.statusgroup})
this.updateVoting({username: this.editedItem.username, voting: this.editedItem.voting.value})
this.close()
}
},
computed: {
...mapGetters({
users: 'usermanager/users',
status: 'usermanager/status'
}),
computeStatus() {
return id => {
return this.status.find(a => {
return a.id === id
}).name
}
},
allVotings() {
return this.users.filter(a => {
return a.voting
}).length
}
},
created() {
this.getUsers()
this.getStatus()
}
}
</script>
<style scoped></style>

View File

@ -1,10 +1,11 @@
//const main = 'https://192.168.5.128:5000/' //const main = 'https://192.168.5.128:5000/'
const main = 'http://localhost:5000/' //const main = 'http://localhost:5000/'
//const main = 'http://192.168.5.118:5000/' const main = 'http://192.168.5.118:5000/'
//const main = 'https://groeger-clan.duckdns.org:5000/' //const main = 'https://groeger-clan.duckdns.org:5000/'
const url = { const url = {
login: main + 'login', login: main + 'login',
getUsers: main + 'getUsers',
pricelist: main + 'pricelist', pricelist: main + 'pricelist',
getTypes: main + 'drinkTypes', getTypes: main + 'drinkTypes',
getFinanzerMain: main + 'getFinanzerMain', getFinanzerMain: main + 'getFinanzerMain',
@ -28,6 +29,13 @@ const url = {
deleteUser: main + 'sm/deleteUser', deleteUser: main + 'sm/deleteUser',
getUser: main + 'sm/getUser', getUser: main + 'sm/getUser',
lockDay: main + 'sm/lockDay' lockDay: main + 'sm/lockDay'
},
um: {
setStatus: main + 'um/setStatus',
updateStatus: main + 'um/updateStatus',
deleteStatus: main + 'um/deleteStatus',
updateStatusUser: main + 'um/updateStatusUser',
updateVoting: main + 'um/updateVoting'
} }
}, },
user: { user: {
@ -40,7 +48,9 @@ const url = {
jobRequests: main + 'user/jobRequests', jobRequests: main + 'user/jobRequests',
getTransactJobs: main + 'user/getTransactJobs', getTransactJobs: main + 'user/getTransactJobs',
deleteTransactJobs: main + 'user/deleteTransactJob', deleteTransactJobs: main + 'user/deleteTransactJob',
storno: main + 'user/storno' storno: main + 'user/storno',
getAllStatus: main + 'getAllStatus',
getStatus: main + 'getStatus'
}, },
barU: { barU: {
storno: main + 'bar/storno' storno: main + 'bar/storno'

View File

@ -22,6 +22,7 @@ import PriceList from '@/components/pricelist/PriceList'
import ManagementNavigation from "@/components/vorstand/ManagementNavigation"; import ManagementNavigation from "@/components/vorstand/ManagementNavigation";
import GastroNavigation from "@/components/gastro/GastroNavigation"; import GastroNavigation from "@/components/gastro/GastroNavigation";
import PriceListView from "@/views/contents/PriceListView"; import PriceListView from "@/views/contents/PriceListView";
import UserManager from "@/components/vorstand/UserManager";
Vue.use(VueRouter) Vue.use(VueRouter)
@ -49,6 +50,10 @@ const routes = [
{ {
path: 'servicemanagement', path: 'servicemanagement',
component: ServiceManagement component: ServiceManagement
},
{
path: 'usermanager',
component: UserManager
} }
] ]
}, },

View File

@ -8,6 +8,7 @@ import sm from '@/store/modules/serviceManagement'
import jobs from '@/store/modules/jobs' import jobs from '@/store/modules/jobs'
import requestJobs from '@/store/modules/jobRequests' import requestJobs from '@/store/modules/jobRequests'
import priceList from '@/store/modules/pricelist' import priceList from '@/store/modules/pricelist'
import usermanager from '@/store/modules/userManager'
Vue.use(Vuex) Vue.use(Vuex)
@ -20,6 +21,7 @@ export default new Vuex.Store({
sm, sm,
jobs, jobs,
requestJobs, requestJobs,
priceList priceList,
usermanager
} }
}) })

View File

@ -136,7 +136,11 @@ const actions = {
commit('setUsersLoading', false) commit('setUsersLoading', false)
}, },
async addAmount({ commit, rootState, dispatch }, data) { async addAmount({ commit, rootState, dispatch }, data) {
try {
commit('updateUser', {username: data.username, loading: true}) commit('updateUser', {username: data.username, loading: true})
} catch (e) {
console.log(e)
}
try { try {
const response = await axios.post( const response = await axios.post(
url.barAddAmount, url.barAddAmount,
@ -158,10 +162,18 @@ const actions = {
if (e.response) if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true }) if (e.response.status === 401) dispatch('logout', null, { root: true })
} }
try {
commit('updateUser', {username: data.username, loading: false}) commit('updateUser', {username: data.username, loading: false})
} catch (e) {
console.log(e)
}
}, },
async addCreditList({ commit, rootState, dispatch }, data) { async addCreditList({ commit, rootState, dispatch }, data) {
try {
commit('updateUser', {username: data.username, loading: true}) commit('updateUser', {username: data.username, loading: true})
} catch (e) {
console.log(e)
}
try { try {
const response = await axios.post( const response = await axios.post(
url.barGetUser, url.barGetUser,
@ -173,7 +185,11 @@ const actions = {
if (e.response) if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true }) if (e.response.status === 401) dispatch('logout', null, { root: true })
} }
try {
commit('updateUser', {username: data.username, loading: false}) commit('updateUser', {username: data.username, loading: false})
} catch (e) {
console.log(e)
}
}, },
async getAllUsers({ commit, rootState, dispatch }) { async getAllUsers({ commit, rootState, dispatch }) {
commit('setAllUsersLoading', true) commit('setAllUsersLoading', true)

View File

@ -8,10 +8,14 @@ const state = {
addLoading: false, addLoading: false,
error: '', error: '',
days: [], days: [],
message: [] message: [],
status: []
} }
const mutations = { const mutations = {
setStatus: (state, status) => {
state.status = status
},
setUser: (state, user) => { setUser: (state, user) => {
state.user = user state.user = user
let list = {} let list = {}
@ -311,6 +315,17 @@ const actions = {
if (e.response.status === 401) dispatch('logout', null, { root: true }) if (e.response.status === 401) dispatch('logout', null, { root: true })
} }
commit('updateMessage', { date: data.date, loading: false }) commit('updateMessage', { date: data.date, loading: false })
},
async getStatus({commit, rootState, dispatch }) {
try {
const response = await axios.get(url.user.getAllStatus, {
headers: { Token: rootState.login.user.accessToken }
})
commit('setStatus', response.data)
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
}
} }
} }
@ -340,6 +355,9 @@ const getters = {
}, },
messages: state => { messages: state => {
return state.message return state.message
},
status: state => {
return state.status
} }
} }

View File

@ -0,0 +1,163 @@
import url from '@/plugins/routes'
import axios from 'axios'
const state = {
users: [],
status: []
}
const mutations = {
setUsers: (state, users) => {
state.users = users
},
setStatus: (state, status) => {
state.status = status
},
updateUser: (state, user) => {
let exists = state.users.find(a => {
return a.username === user.username
})
if (exists) {
exists.firstname = user.firstname
exists.lastname = user.lastname
exists.mail = user.mail
exists.statusgroup = user.statusgroup
exists.voting = user.voting
} else {
state.users.push({
username: user.username,
firstname: user.firstname,
lastname: user.lastname,
mail: user.mail,
statusgroup: user.statusgroup,
voting: user.voting
})
}
},
updateStatus: (state, status) => {
let exists = state.status.find(a => {
return a.id === status.id
})
if (exists) {
exists.name = status.name
} else {
state.status.push(status)
}
},
deleteStatus: (state, status) => {
let index = state.status.indexOf(
state.status.find(a => {
return a.id === status.id
})
)
state.status.splice(index, 1)
}
}
const actions = {
async getUsers({ commit, rootState, dispatch }) {
try {
const response = await axios.get(url.getUsers, {
headers: { Token: rootState.login.user.accessToken }
})
commit('setUsers', response.data)
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
}
},
async getStatus({ commit, rootState, dispatch }) {
try {
const response = await axios.get(url.user.getAllStatus, {
headers: { Token: rootState.login.user.accessToken }
})
commit('setStatus', response.data)
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
}
},
async updateStatus({ commit, rootState, dispatch }, data) {
try {
const response = await axios.post(
url.vorstand.um.updateStatus,
{ ...data },
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('updateStatus', response.data)
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
}
},
async setStatus({ commit, rootState, dispatch }, data) {
try {
const response = await axios.post(
url.vorstand.um.setStatus,
{ ...data },
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('updateStatus', response.data)
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
}
},
async deleteStatus({ commit, rootState, dispatch }, data) {
try {
await axios.post(
url.vorstand.um.deleteStatus,
{ ...data },
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('deleteStatus', data)
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
}
},
async updateStatusUser({ commit, rootState, dispatch }, data) {
try {
const response = await axios.post(
url.vorstand.um.updateStatusUser,
{ ...data },
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('updateUser', response.data)
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
}
},
async updateVoting({ commit, rootState, dispatch }, data) {
try {
const response = await axios.post(
url.vorstand.um.updateVoting,
{ ...data },
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('updateUser', response.data)
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
}
}
}
const getters = {
users: state => {
return state.users
},
status: state => {
return state.status
}
}
export default {
namespaced: true,
state,
mutations,
actions,
getters
}