AfterStore: If we already have a token, use it directly.
This commit is contained in:
parent
fffda79ee2
commit
95b75fc1d9
1 changed files with 11 additions and 8 deletions
|
|
@ -230,12 +230,16 @@ const getStickers = async ({ store }) => {
|
||||||
const getAppSecret = async ({ store }) => {
|
const getAppSecret = async ({ store }) => {
|
||||||
const { state, commit } = store
|
const { state, commit } = store
|
||||||
const { oauth, instance } = state
|
const { oauth, instance } = state
|
||||||
return getOrCreateApp({ ...oauth, instance: instance.server, commit })
|
if (oauth.userToken) {
|
||||||
.then((app) => getClientToken({ ...app, instance: instance.server }))
|
commit('setBackendInteractor', backendInteractorService(store.getters.getToken()))
|
||||||
.then((token) => {
|
} else {
|
||||||
commit('setAppToken', token.access_token)
|
return getOrCreateApp({ ...oauth, instance: instance.server, commit })
|
||||||
commit('setBackendInteractor', backendInteractorService(store.getters.getToken()))
|
.then((app) => getClientToken({ ...app, instance: instance.server }))
|
||||||
})
|
.then((token) => {
|
||||||
|
commit('setAppToken', token.access_token)
|
||||||
|
commit('setBackendInteractor', backendInteractorService(store.getters.getToken()))
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const resolveStaffAccounts = ({ store, accounts }) => {
|
const resolveStaffAccounts = ({ store, accounts }) => {
|
||||||
|
|
@ -377,10 +381,9 @@ const afterStoreSetup = async ({ pinia, store, storageError, i18n }) => {
|
||||||
getInstanceConfig({ store })
|
getInstanceConfig({ store })
|
||||||
]).catch(e => Promise.reject(e))
|
]).catch(e => Promise.reject(e))
|
||||||
|
|
||||||
await store.dispatch('loadDrafts')
|
|
||||||
|
|
||||||
// Start fetching things that don't need to block the UI
|
// Start fetching things that don't need to block the UI
|
||||||
store.dispatch('fetchMutes')
|
store.dispatch('fetchMutes')
|
||||||
|
store.dispatch('loadDrafts')
|
||||||
useAnnouncementsStore().startFetchingAnnouncements()
|
useAnnouncementsStore().startFetchingAnnouncements()
|
||||||
getTOS({ store })
|
getTOS({ store })
|
||||||
getStickers({ store })
|
getStickers({ store })
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue