logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git

oauth_tokens.js (637B)


  1. const oauthTokens = {
  2. state: {
  3. tokens: []
  4. },
  5. actions: {
  6. fetchTokens ({ rootState, commit }) {
  7. rootState.api.backendInteractor.fetchOAuthTokens().then((tokens) => {
  8. commit('swapTokens', tokens)
  9. })
  10. },
  11. revokeToken ({ rootState, commit, state }, id) {
  12. rootState.api.backendInteractor.revokeOAuthToken({ id }).then((response) => {
  13. if (response.status === 201) {
  14. commit('swapTokens', state.tokens.filter(token => token.id !== id))
  15. }
  16. })
  17. }
  18. },
  19. mutations: {
  20. swapTokens (state, tokens) {
  21. state.tokens = tokens
  22. }
  23. }
  24. }
  25. export default oauthTokens