2018-10-27 00:16:23 +11:00
|
|
|
const oauth = {
|
|
|
|
state: {
|
2019-05-23 02:13:41 +10:00
|
|
|
clientId: false,
|
|
|
|
clientSecret: false,
|
2019-06-13 07:39:51 +10:00
|
|
|
appToken: false,
|
|
|
|
userToken: false
|
2018-10-27 00:16:23 +11:00
|
|
|
},
|
|
|
|
mutations: {
|
2019-05-23 02:13:41 +10:00
|
|
|
setClientData (state, { clientId, clientSecret }) {
|
|
|
|
state.clientId = clientId
|
|
|
|
state.clientSecret = clientSecret
|
|
|
|
},
|
|
|
|
setClientToken (state, token) {
|
2019-06-13 07:39:51 +10:00
|
|
|
state.appToken = token
|
2018-10-27 00:16:23 +11:00
|
|
|
},
|
|
|
|
setToken (state, token) {
|
2019-06-13 07:39:51 +10:00
|
|
|
state.userToken = token
|
2018-10-27 00:16:23 +11:00
|
|
|
}
|
2019-05-23 02:13:41 +10:00
|
|
|
},
|
|
|
|
getters: {
|
|
|
|
getToken: state => () => {
|
2019-06-13 07:39:51 +10:00
|
|
|
return state.userToken || state.appToken
|
2019-05-23 02:13:41 +10:00
|
|
|
}
|
2018-10-27 00:16:23 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default oauth
|