use OAuthStore directly
This commit is contained in:
parent
529a2d100b
commit
3984a5aefa
44 changed files with 226 additions and 256 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { cloneDeep, differenceWith, flatten, get, isEqual, set } from 'lodash'
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import {
|
||||
addNewEmojiFile,
|
||||
|
|
@ -86,7 +86,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
|
||||
loadAdminStuff() {
|
||||
getInstanceDBConfig({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((backendDbConfig) => {
|
||||
if (backendDbConfig.error) {
|
||||
if (backendDbConfig.error.status === 400) {
|
||||
|
|
@ -98,17 +98,17 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
}
|
||||
} else {
|
||||
this.setInstanceAdminSettings({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
backendDbConfig,
|
||||
})
|
||||
}
|
||||
})
|
||||
if (this.descriptions === null) {
|
||||
getInstanceConfigDescriptions({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((backendDescriptions) =>
|
||||
this.setInstanceAdminDescriptions({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
backendDescriptions,
|
||||
}),
|
||||
)
|
||||
|
|
@ -243,19 +243,19 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
})
|
||||
|
||||
pushInstanceDBConfig({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
payload: {
|
||||
configs: changed,
|
||||
},
|
||||
})
|
||||
.then(() =>
|
||||
getInstanceDBConfig({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}),
|
||||
)
|
||||
.then((backendDbConfig) =>
|
||||
this.setInstanceAdminSettings({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
|
||||
backendDbConfig,
|
||||
}),
|
||||
|
|
@ -280,7 +280,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
}
|
||||
|
||||
pushInstanceDBConfig({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
payload: {
|
||||
configs: [
|
||||
{
|
||||
|
|
@ -293,12 +293,12 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
})
|
||||
.then(() =>
|
||||
getInstanceDBConfig({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}),
|
||||
)
|
||||
.then((backendDbConfig) =>
|
||||
this.setInstanceAdminSettings({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
backendDbConfig,
|
||||
}),
|
||||
)
|
||||
|
|
@ -311,7 +311,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
this.modifiedPaths.delete(path)
|
||||
|
||||
return pushInstanceDBConfig({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
payload: {
|
||||
configs: [
|
||||
{
|
||||
|
|
@ -325,7 +325,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
})
|
||||
.then(() =>
|
||||
getInstanceDBConfig({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}),
|
||||
)
|
||||
.then((backendDbConfig) =>
|
||||
|
|
@ -336,7 +336,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
// Frontends Stuff
|
||||
loadFrontendsStuff() {
|
||||
getAvailableFrontends({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((frontends) => this.setAvailableFrontends({ frontends }))
|
||||
},
|
||||
|
||||
|
|
@ -354,14 +354,14 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
|
||||
installFrontend() {
|
||||
return installFrontend({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
},
|
||||
|
||||
// Statuses stuff
|
||||
async fetchStatuses(opts) {
|
||||
const { total, activities } = await listStatuses({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
opts,
|
||||
})
|
||||
|
||||
|
|
@ -376,7 +376,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
},
|
||||
async changeStatusScope(opts) {
|
||||
const raw = await changeStatusScope({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
opts,
|
||||
})
|
||||
const status = parseStatus(raw)
|
||||
|
|
@ -387,7 +387,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
// Users stuff
|
||||
async fetchUsers(opts) {
|
||||
const { users, count } = await listUsers({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
|
||||
opts,
|
||||
})
|
||||
|
|
@ -409,7 +409,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
const { screen_name } = user
|
||||
|
||||
const result = await api({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
screen_name,
|
||||
})
|
||||
window.vuex.commit('updateUserAdminData', { user: result })
|
||||
|
|
@ -419,7 +419,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
const api = deleteAccounts
|
||||
|
||||
const resultUserIds = await api({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
screen_names,
|
||||
})
|
||||
|
||||
|
|
@ -437,7 +437,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
const screen_names = users.map((u) => u.screen_name)
|
||||
|
||||
return resendConfirmationEmail({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
screen_names,
|
||||
})
|
||||
},
|
||||
|
|
@ -445,7 +445,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
const screen_names = users.map((u) => u.screen_name)
|
||||
|
||||
return requirePasswordChange({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
screen_names,
|
||||
})
|
||||
},
|
||||
|
|
@ -454,7 +454,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
const { screen_name } = user
|
||||
|
||||
return disableMFA({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
screen_name,
|
||||
})
|
||||
},
|
||||
|
|
@ -463,7 +463,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
const api = setUsersTags
|
||||
|
||||
await api({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
screen_names,
|
||||
tags,
|
||||
value,
|
||||
|
|
@ -478,7 +478,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
const api = setUsersRight
|
||||
|
||||
await api({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
screen_names,
|
||||
right,
|
||||
value,
|
||||
|
|
@ -493,7 +493,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
const api = setUsersActivationStatus
|
||||
|
||||
const resultUsers = await api({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
screen_names,
|
||||
value,
|
||||
})
|
||||
|
|
@ -507,7 +507,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
const api = setUsersSuggestionStatus
|
||||
|
||||
const resultUsers = await api({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
screen_names,
|
||||
value,
|
||||
})
|
||||
|
|
@ -521,7 +521,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
const api = setUsersConfirmationStatus
|
||||
|
||||
await api({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
screen_names,
|
||||
})
|
||||
|
||||
|
|
@ -534,7 +534,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
const api = setUsersApprovalStatus
|
||||
|
||||
const resultUsers = await api({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
screen_names,
|
||||
})
|
||||
|
||||
|
|
@ -543,21 +543,21 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
})
|
||||
},
|
||||
reloadEmoji() {
|
||||
return reloadEmoji({ credentials: useCredentialsStore().current })
|
||||
return reloadEmoji({ credentials: useOAuthStore().token })
|
||||
},
|
||||
importEmojiFromFS() {
|
||||
return importEmojiFromFS({ credentials: useCredentialsStore().current })
|
||||
return importEmojiFromFS({ credentials: useOAuthStore().token })
|
||||
},
|
||||
listEmojiPacks(params) {
|
||||
return listEmojiPacks({
|
||||
...params,
|
||||
credentials: useCredentialsStore().current
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
},
|
||||
listRemoteEmojiPacks(params) {
|
||||
return listRemoteEmojiPacks({
|
||||
...params,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
},
|
||||
addNewEmojiFile({ packName, file, shortcode, filename }) {
|
||||
|
|
@ -566,7 +566,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
file,
|
||||
shortcode,
|
||||
filename,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
},
|
||||
downloadRemoteEmojiPack({ instance, packName, as }) {
|
||||
|
|
@ -574,33 +574,33 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
instance,
|
||||
packName,
|
||||
as,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
},
|
||||
downloadRemoteEmojiPackZIP({ url, packName }) {
|
||||
return downloadRemoteEmojiPackZIP({
|
||||
url,
|
||||
packName,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
},
|
||||
createEmojiPack({ name }) {
|
||||
return createEmojiPack({
|
||||
name,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
},
|
||||
deleteEmojiPack({ name }) {
|
||||
return createEmojiPack({
|
||||
name,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
},
|
||||
saveEmojiPackMetadata({ name, newData }) {
|
||||
return createEmojiPack({
|
||||
name,
|
||||
newData,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { defineStore } from 'pinia'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import {
|
||||
getAnnouncements as adminGetAnnouncements,
|
||||
|
|
@ -47,15 +47,15 @@ export const useAnnouncementsStore = defineStore('announcements', {
|
|||
const fetchAnnouncements = async () => {
|
||||
if (!isAdmin) {
|
||||
return getAnnouncements({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
}
|
||||
|
||||
const all = await adminGetAnnouncements({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
const visible = await getAnnouncements({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
const visibleObject = visible.reduce((a, c) => {
|
||||
a[c.id] = c
|
||||
|
|
@ -93,7 +93,7 @@ export const useAnnouncementsStore = defineStore('announcements', {
|
|||
markAnnouncementAsRead(id) {
|
||||
return dismissAnnouncement({
|
||||
id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(() => {
|
||||
const index = this.announcements.findIndex((a) => a.id === id)
|
||||
|
||||
|
|
@ -124,7 +124,7 @@ export const useAnnouncementsStore = defineStore('announcements', {
|
|||
},
|
||||
postAnnouncement({ content, startsAt, endsAt, allDay }) {
|
||||
return postAnnouncement({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
content,
|
||||
startsAt,
|
||||
endsAt,
|
||||
|
|
@ -140,7 +140,7 @@ export const useAnnouncementsStore = defineStore('announcements', {
|
|||
startsAt,
|
||||
endsAt,
|
||||
allDay,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(() => {
|
||||
return this.fetchAnnouncements()
|
||||
})
|
||||
|
|
@ -148,7 +148,7 @@ export const useAnnouncementsStore = defineStore('announcements', {
|
|||
deleteAnnouncement(id) {
|
||||
return deleteAnnouncement({
|
||||
id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(() => {
|
||||
return this.fetchAnnouncements()
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { find, remove } from 'lodash'
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import {
|
||||
createBookmarkFolder,
|
||||
|
|
@ -29,7 +29,7 @@ export const useBookmarkFoldersStore = defineStore('bookmarkFolders', {
|
|||
startFetching() {
|
||||
promiseInterval(() => {
|
||||
this.fetcher = fetchBookmarkFolders({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
.then(
|
||||
(folders) => this.setBookmarkFolders(folders),
|
||||
|
|
@ -60,7 +60,7 @@ export const useBookmarkFoldersStore = defineStore('bookmarkFolders', {
|
|||
return createBookmarkFolder({
|
||||
name,
|
||||
emoji,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((folder) => {
|
||||
this.setBookmarkFolder(folder)
|
||||
return folder
|
||||
|
|
@ -68,7 +68,7 @@ export const useBookmarkFoldersStore = defineStore('bookmarkFolders', {
|
|||
},
|
||||
updateBookmarkFolder({ folderId, name, emoji }) {
|
||||
return updateBookmarkFolder({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
folderId,
|
||||
name,
|
||||
emoji,
|
||||
|
|
@ -80,7 +80,7 @@ export const useBookmarkFoldersStore = defineStore('bookmarkFolders', {
|
|||
deleteBookmarkFolder({ folderId }) {
|
||||
deleteBookmarkFolder({
|
||||
folderId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
remove(this.allFolders, (folder) => folder.id === folderId)
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
import { defineStore } from 'pinia'
|
||||
|
||||
const defaultState = {
|
||||
credentials: null,
|
||||
}
|
||||
|
||||
export const useCredentialsStore = defineStore('credentials', {
|
||||
state: () => ({ ...defaultState }),
|
||||
actions: {
|
||||
setCredentials(credentials) {
|
||||
this.credentials = credentials
|
||||
},
|
||||
},
|
||||
getters: {
|
||||
current() {
|
||||
return this.credentials
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
import { merge } from 'lodash'
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { ensureFinalFallback } from 'src/i18n/languages.js'
|
||||
import { listEmojiPacks } from 'src/services/api/api.service.js'
|
||||
|
|
@ -188,9 +188,10 @@ export const useEmojiStore = defineStore('emoji', {
|
|||
this.adminPacksLocalLoading = true
|
||||
this.adminPacksLocal = await this.getAdminPacks(
|
||||
useInstanceStore().server,
|
||||
(params) => listEmojiPacks({
|
||||
(params) =>
|
||||
listEmojiPacks({
|
||||
...params,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}),
|
||||
)
|
||||
this.adminPacksLocalLoading = false
|
||||
|
|
@ -221,14 +222,13 @@ export const useEmojiStore = defineStore('emoji', {
|
|||
instance,
|
||||
page: i,
|
||||
pageSize,
|
||||
})
|
||||
.then((pageData) => {
|
||||
if (pageData.error !== undefined) {
|
||||
return Promise.reject(pageData.error)
|
||||
}
|
||||
}).then((pageData) => {
|
||||
if (pageData.error !== undefined) {
|
||||
return Promise.reject(pageData.error)
|
||||
}
|
||||
|
||||
return pageData.packs
|
||||
}),
|
||||
return pageData.packs
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { find, remove } from 'lodash'
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import {
|
||||
addAccountsToList,
|
||||
|
|
@ -36,7 +36,7 @@ export const useListsStore = defineStore('lists', {
|
|||
startFetching() {
|
||||
promiseInterval(() => {
|
||||
this.fetcher = fetchLists({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
.then(
|
||||
(lists) => this.setLists(lists),
|
||||
|
|
@ -56,7 +56,7 @@ export const useListsStore = defineStore('lists', {
|
|||
createList({ title }) {
|
||||
return createList({
|
||||
title,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((list) => {
|
||||
this.setList({ listId: list.id, title })
|
||||
return list
|
||||
|
|
@ -65,13 +65,13 @@ export const useListsStore = defineStore('lists', {
|
|||
fetchList({ listId }) {
|
||||
return getList({
|
||||
listId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((list) => this.setList({ listId: list.id, title: list.title }))
|
||||
},
|
||||
fetchListAccounts({ listId }) {
|
||||
return getListAccounts({
|
||||
listId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((accountIds) => {
|
||||
if (!this.allListsObject[listId]) {
|
||||
this.allListsObject[listId] = { accountIds: [] }
|
||||
|
|
@ -83,7 +83,7 @@ export const useListsStore = defineStore('lists', {
|
|||
updateList({
|
||||
listId,
|
||||
title,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
|
||||
if (!this.allListsObject[listId]) {
|
||||
|
|
@ -110,14 +110,14 @@ export const useListsStore = defineStore('lists', {
|
|||
addAccountsToList({
|
||||
listId,
|
||||
accountIds: added,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
}
|
||||
if (removed.length > 0) {
|
||||
removeAccountsFromList({
|
||||
listId,
|
||||
accountIds: removed,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
}
|
||||
},
|
||||
|
|
@ -125,7 +125,7 @@ export const useListsStore = defineStore('lists', {
|
|||
return addAccountsToList({
|
||||
listId,
|
||||
accountIds: [accountId],
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((result) => {
|
||||
if (!this.allListsObject[listId]) {
|
||||
this.allListsObject[listId] = { accountIds: [] }
|
||||
|
|
@ -138,7 +138,7 @@ export const useListsStore = defineStore('lists', {
|
|||
return removeAccountsFromList({
|
||||
listId,
|
||||
accountIds: [accountId],
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((result) => {
|
||||
if (!this.allListsObject[listId]) {
|
||||
this.allListsObject[listId] = { accountIds: [] }
|
||||
|
|
@ -154,7 +154,7 @@ export const useListsStore = defineStore('lists', {
|
|||
deleteList({ listId }) {
|
||||
deleteList({
|
||||
listId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
|
||||
delete this.allListsObject[listId]
|
||||
|
|
|
|||
|
|
@ -41,12 +41,9 @@ export const useOAuthStore = defineStore('oauth', {
|
|||
userToken: false,
|
||||
}),
|
||||
getters: {
|
||||
getToken() {
|
||||
token() {
|
||||
return this.userToken || this.appToken
|
||||
},
|
||||
getUserToken() {
|
||||
return this.userToken
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
setClientData({ clientId, clientSecret }) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { defineStore } from 'pinia'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import {
|
||||
fetchOAuthTokens,
|
||||
|
|
@ -14,7 +14,7 @@ export const useOAuthTokensStore = defineStore('oauthTokens', {
|
|||
actions: {
|
||||
fetchTokens() {
|
||||
fetchOAuthTokens({
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((tokens) => {
|
||||
this.swapTokens(tokens)
|
||||
})
|
||||
|
|
@ -22,7 +22,7 @@ export const useOAuthTokensStore = defineStore('oauthTokens', {
|
|||
revokeToken(id) {
|
||||
revokeOAuthToken({
|
||||
id,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((response) => {
|
||||
if (response.status === 201) {
|
||||
this.swapTokens(this.tokens.filter((token) => token.id !== id))
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { merge } from 'lodash'
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { fetchPoll, vote } from 'src/services/api/api.service.js'
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ export const usePollsStore = defineStore('polls', {
|
|||
updateTrackedPoll(pollId) {
|
||||
fetchPoll({
|
||||
pollId,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((poll) => {
|
||||
setTimeout(() => {
|
||||
if (this.trackedPolls[pollId]) {
|
||||
|
|
@ -58,7 +58,7 @@ export const usePollsStore = defineStore('polls', {
|
|||
return vote({
|
||||
pollId,
|
||||
choices,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((poll) => {
|
||||
this.mergeOrAddPoll(poll)
|
||||
return poll
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { filter } from 'lodash'
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { setReportState } from 'src/services/api/admin.js'
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ export const useReportsStore = defineStore('reports', {
|
|||
setReportState({
|
||||
id,
|
||||
state,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).catch((e) => {
|
||||
console.error('Failed to set report state', e)
|
||||
useInterfaceStore().pushGlobalNotice({
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ import { toRaw } from 'vue'
|
|||
|
||||
import { CURRENT_UPDATE_COUNTER } from 'src/components/update_notification/update_notification.js'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useLocalConfigStore } from 'src/stores/local_config.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { storage } from 'src/lib/storage.js'
|
||||
import {
|
||||
|
|
@ -793,7 +793,7 @@ export const useSyncConfigStore = defineStore('sync_config', {
|
|||
const params = { pleroma_settings_store: { 'pleroma-fe': this.cache } }
|
||||
updateProfileJSON({
|
||||
params,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import {
|
|||
import { defineStore } from 'pinia'
|
||||
import { toRaw } from 'vue'
|
||||
|
||||
import { useCredentialsStore } from 'src/stores/credentials.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { storage } from 'src/lib/storage.js'
|
||||
import { updateProfileJSON } from 'src/services/api/api.service.js'
|
||||
|
|
@ -349,7 +349,7 @@ export const useUserHighlightStore = defineStore('user_highlight', {
|
|||
}
|
||||
updateProfileJSON({
|
||||
params,
|
||||
credentials: useCredentialsStore().current,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((user) => {
|
||||
this.initUserHighlight(user)
|
||||
this.dirty = false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue