Migrate oauth tokens module to pinia store

This commit is contained in:
Sean King 2025-05-10 22:35:15 -06:00
commit 27f753e8de
No known key found for this signature in database
GPG key ID: 510C52BACD6E7257
7 changed files with 32 additions and 33 deletions

View file

@ -7,7 +7,6 @@ import config from './config.js'
import profileConfig from './profileConfig.js'
import adminSettings from './adminSettings.js'
import authFlow from './auth_flow.js'
import oauthTokens from './oauth_tokens.js'
import drafts from './drafts.js'
import chats from './chats.js'
@ -21,7 +20,6 @@ export default {
profileConfig,
adminSettings,
authFlow,
oauthTokens,
drafts,
chats
}

View file

@ -1,26 +0,0 @@
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