Updated site and member data to load in parallel

no refs

Previously, the site and member data needed by Portal were loaded sequentially, which delayed the first load slightly as both the requests can be instead made in parallel. This change updates the API init to load both requests in parallel.
This commit is contained in:
Rishabh 2021-05-24 18:10:48 +05:30
parent 9472a29568
commit 8ac6364d3a

View File

@ -244,8 +244,10 @@ function setupGhostApi({siteUrl = window.location.origin}) {
};
api.init = async () => {
const {site} = await api.site.read();
const member = await api.member.sessionData();
const [{site}, member] = await Promise.all([
api.site.read(),
api.member.sessionData()
]);
return {site, member};
};