Add OAuth Tokens management to settings See merge request pleroma/pleroma-fe!572deploy-ci
commit
efc4fa1099
@ -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…
Reference in new issue