diff --git a/src/_store/system.module.js b/src/_store/system.module.js index 76e901f..0176dd3 100644 --- a/src/_store/system.module.js +++ b/src/_store/system.module.js @@ -1,5 +1,6 @@ import { systemService } from '../_services'; import { account } from "./account.module"; +import {router} from "../_helpers"; const state = { configs: { @@ -45,6 +46,17 @@ const actions = { error => commit('loadIsActivatedFailure', error) ); }, + activate({ commit }, activation) { + commit('activateRequest'); + systemService.activate(activation) + .then( + admin => { + commit('activateSuccess', admin); + router.replace('/'); + }, + error => commit('activateFailure', error) + ); + }, loadSystemConfigs({ commit }) { commit('loadSystemConfigsRequest'); @@ -184,6 +196,7 @@ const mutations = { state.activated = true; state.user = admin; state.status = { loggedIn: (admin !== null) }; + localStorage.setItem('user', JSON.stringify(admin)); }, activateFailure(state, error) { state.status.activating = false; diff --git a/src/auth/ActivationPage.vue b/src/auth/ActivationPage.vue index f529684..87fa5d7 100644 --- a/src/auth/ActivationPage.vue +++ b/src/auth/ActivationPage.vue @@ -1,7 +1,7 @@