remaining backend interactor removals
This commit is contained in:
parent
28efd7ebd2
commit
0d9709825f
45 changed files with 1118 additions and 856 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue