pleroma-fe/src/modules/oauth.js

28 lines
538 B
JavaScript
Raw Normal View History

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