AfterStore: If we already have a token, use it directly.

This commit is contained in:
Lain Soykaf 2025-02-25 00:13:37 +04:00
commit 95b75fc1d9

View file

@ -230,6 +230,9 @@ const getStickers = async ({ store }) => {
const getAppSecret = async ({ store }) => {
const { state, commit } = store
const { oauth, instance } = state
if (oauth.userToken) {
commit('setBackendInteractor', backendInteractorService(store.getters.getToken()))
} else {
return getOrCreateApp({ ...oauth, instance: instance.server, commit })
.then((app) => getClientToken({ ...app, instance: instance.server }))
.then((token) => {
@ -237,6 +240,7 @@ const getAppSecret = async ({ store }) => {
commit('setBackendInteractor', backendInteractorService(store.getters.getToken()))
})
}
}
const resolveStaffAccounts = ({ store, accounts }) => {
const nicknames = accounts.map(uri => uri.split('/').pop())
@ -377,10 +381,9 @@ const afterStoreSetup = async ({ pinia, store, storageError, i18n }) => {
getInstanceConfig({ store })
]).catch(e => Promise.reject(e))
await store.dispatch('loadDrafts')
// Start fetching things that don't need to block the UI
store.dispatch('fetchMutes')
store.dispatch('loadDrafts')
useAnnouncementsStore().startFetchingAnnouncements()
getTOS({ store })
getStickers({ store })