akkoma-fe/src/modules/oauth.js

28 lines
535 B
JavaScript
Raw Normal View History

2018-10-26 13:16:23 +00:00
const oauth = {
state: {
clientId: false,
clientSecret: false,
token: false,
clientToken: false
2018-10-26 13:16:23 +00:00
},
mutations: {
setClientData (state, { clientId, clientSecret }) {
state.clientId = clientId
state.clientSecret = clientSecret
},
setClientToken (state, token) {
state.clientToken = token
2018-10-26 13:16:23 +00:00
},
setToken (state, token) {
state.token = token
}
},
getters: {
getToken: state => () => {
return state.token || state.clientToken
}
2018-10-26 13:16:23 +00:00
}
}
export default oauth