47 lines
910 B
JavaScript
47 lines
910 B
JavaScript
import { WatchMsalState, GetMsalState } from '@/msal'
|
|
|
|
// initial state
|
|
const state = () => ({
|
|
isLoggedIn: false,
|
|
accessToken: null,
|
|
idToken: null,
|
|
email: null,
|
|
displayName: null,
|
|
|
|
debugFullTokenResponse: null,
|
|
debugAccountInfo: null,
|
|
})
|
|
|
|
// getters
|
|
const getters = {}
|
|
|
|
// actions
|
|
const actions = {
|
|
initialize({ commit }) {
|
|
WatchMsalState(() => {
|
|
commit('setState', GetMsalState())
|
|
})
|
|
},
|
|
}
|
|
|
|
// mutations
|
|
const mutations = {
|
|
setState(state, msalState) {
|
|
state.isLoggedIn = msalState.isLoggedIn
|
|
state.accessToken = msalState.accessToken
|
|
state.idToken = msalState.idToken
|
|
state.debugFullTokenResponse = msalState.debugFullTokenResponse
|
|
state.debugAccountInfo = msalState.debugAccountInfo
|
|
state.email = msalState.email
|
|
state.displayName = msalState.displayName
|
|
},
|
|
}
|
|
|
|
export default {
|
|
namespaced: true,
|
|
state,
|
|
getters,
|
|
actions,
|
|
mutations,
|
|
}
|