Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pleroma-fe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pleroma
pleroma-fe
Commits
ae3b92ce
Commit
ae3b92ce
authored
5 years ago
by
Shpuld Shpludson
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix/sending-requests-when-loading' into 'develop'
#463
Add Promise.all to send requests when loading Closes
#463
See merge request
!723
parents
3b38e1b8
90939f19
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!1028
`master` refresh with `develop`
,
!723
#463 Add Promise.all to send requests when loading
Pipeline
#9816
passed
5 years ago
Stage: lint
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/boot/after_store.js
+32
-13
32 additions, 13 deletions
src/boot/after_store.js
with
32 additions
and
13 deletions
src/boot/after_store.js
+
32
−
13
View file @
ae3b92ce
...
...
@@ -219,6 +219,28 @@ const getNodeInfo = async ({ store }) => {
}
}
const
setConfig
=
async
({
store
})
=>
{
// apiConfig, staticConfig
const
configInfos
=
await
Promise
.
all
([
getStatusnetConfig
({
store
}),
getStaticConfig
()])
const
apiConfig
=
configInfos
[
0
]
const
staticConfig
=
configInfos
[
1
]
await
setSettings
({
store
,
apiConfig
,
staticConfig
})
}
const
checkOAuthToken
=
async
({
store
})
=>
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
if
(
store
.
state
.
oauth
.
token
)
{
try
{
await
store
.
dispatch
(
'
loginUser
'
,
store
.
state
.
oauth
.
token
)
}
catch
(
e
)
{
console
.
log
(
e
)
}
}
resolve
()
})
}
const
afterStoreSetup
=
async
({
store
,
i18n
})
=>
{
if
(
store
.
state
.
config
.
customTheme
)
{
// This is a hack to deal with async loading of config.json and themes
...
...
@@ -230,19 +252,16 @@ const afterStoreSetup = async ({ store, i18n }) => {
})
}
const
apiConfig
=
await
getStatusnetConfig
({
store
})
const
staticConfig
=
await
getStaticConfig
()
await
setSettings
({
store
,
apiConfig
,
staticConfig
})
await
getTOS
({
store
})
await
getInstancePanel
({
store
})
await
getStaticEmoji
({
store
})
await
getCustomEmoji
({
store
})
await
getNodeInfo
({
store
})
// Now we have the server settings and can try logging in
if
(
store
.
state
.
oauth
.
token
)
{
await
store
.
dispatch
(
'
loginUser
'
,
store
.
state
.
oauth
.
token
)
}
// Now we can try getting the server settings and logging in
await
Promise
.
all
([
checkOAuthToken
({
store
}),
setConfig
({
store
}),
getTOS
({
store
}),
getInstancePanel
({
store
}),
getStaticEmoji
({
store
}),
getCustomEmoji
({
store
}),
getNodeInfo
({
store
})
])
const
router
=
new
VueRouter
({
mode
:
'
history
'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment