You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1009 B
35 lines
1009 B
import {createStore} from 'vuex'
|
|
import createPersistedState from "vuex-persistedstate";
|
|
|
|
import user from './modules/user'
|
|
import backend from './modules/backend'
|
|
import athletes from './modules/athletes'
|
|
import axios, {AxiosResponse} from "axios";
|
|
|
|
export default createStore({
|
|
modules: {
|
|
user,
|
|
backend,
|
|
athletes,
|
|
},
|
|
actions: {
|
|
logout({commit}) {
|
|
return new Promise((resolve, reject) => {
|
|
axios({
|
|
method: 'POST',
|
|
url: '/auth/logout',
|
|
})
|
|
.then((resp: AxiosResponse) => {
|
|
commit('auth_logout');
|
|
commit('athletes_logout');
|
|
commit('server_logout');
|
|
resolve(resp);
|
|
})
|
|
.catch((err: Error) => {
|
|
reject(err);
|
|
});
|
|
});
|
|
}
|
|
},
|
|
plugins: [createPersistedState()]
|
|
})
|
|
|