remaining backend interactor removals

This commit is contained in:
Henry Jameson 2026-06-15 20:02:22 +03:00
commit 0d9709825f
45 changed files with 1118 additions and 856 deletions

View file

@ -1,25 +1,33 @@
import { defineStore } from 'pinia'
import { useCredentialsStore } from 'src/stores/credentials.js'
import {
fetchOAuthTokens,
revokeOAuthToken,
} from 'src/services/api/api.service.js'
export const useOAuthTokensStore = defineStore('oauthTokens', {
state: () => ({
tokens: [],
}),
actions: {
fetchTokens() {
window.vuex.state.api.backendInteractor
.fetchOAuthTokens()
.then((tokens) => {
this.swapTokens(tokens)
})
fetchOAuthTokens({
credentials: useCredentialsStore().current,
}).then((tokens) => {
this.swapTokens(tokens)
})
},
revokeToken(id) {
window.vuex.state.api.backendInteractor
.revokeOAuthToken({ id })
.then((response) => {
if (response.status === 201) {
this.swapTokens(this.tokens.filter((token) => token.id !== id))
}
})
revokeOAuthToken({
id,
credentials: useCredentialsStore().current,
}).then((response) => {
if (response.status === 201) {
this.swapTokens(this.tokens.filter((token) => token.id !== id))
}
})
},
swapTokens(tokens) {
this.tokens = tokens