Add OAuth Tokens management to settings
This commit is contained in:
parent
058238c3c6
commit
2c7406d9a8
25 changed files with 208 additions and 1 deletions
26
src/modules/oauth_tokens.js
Normal file
26
src/modules/oauth_tokens.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
const oauthTokens = {
|
||||
state: {
|
||||
tokens: []
|
||||
},
|
||||
actions: {
|
||||
fetchTokens ({rootState, commit}) {
|
||||
rootState.api.backendInteractor.fetchOAuthTokens().then((tokens) => {
|
||||
commit('swapTokens', tokens)
|
||||
})
|
||||
},
|
||||
revokeToken ({rootState, commit, state}, id) {
|
||||
rootState.api.backendInteractor.revokeOAuthToken(id).then((response) => {
|
||||
if (response.status === 201) {
|
||||
commit('swapTokens', state.tokens.filter(token => token.id !== id))
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
swapTokens (state, tokens) {
|
||||
state.tokens = tokens
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default oauthTokens
|
Loading…
Add table
Add a link
Reference in a new issue