TT#129212 Optimise the initial load of the user

TAC:
Parallelise requests in the user load function which do not depend on each other

Note: it can be optimized better if we lazyload RTCengine and initialize it in a lazy way. But it should be implemented as a separate ticket.

Change-Id: I911cd29b880ab8027b341d7953c6c8337390e19b
mr10.0
Sergii Leonenko 4 years ago committed by Hans-Peter Herzog
parent 0354615428
commit 5a3093e837

@ -39,13 +39,15 @@ export function getUserData (id) {
getSubscriberById(id),
getCapabilities(id),
getFaxServerSettings(id),
getResellerBranding()
]).then((results) => {
results[1].faxactive = results[2].active
getResellerBranding(),
getPlatformInfo()
]).then(([subscriber, capabilities, faxServerSettings, resellerBranding, platformInfo]) => {
capabilities.faxactive = faxServerSettings.active
resolve({
subscriber: results[0],
capabilities: results[1],
resellerBranding: results[3]?.items[0] || null
subscriber,
capabilities,
resellerBranding: resellerBranding?.items[0] || null,
platformInfo
})
}).catch((err) => {
reject(err)
@ -137,6 +139,12 @@ export async function getResellerBranding () {
})
}
export async function getPlatformInfo () {
return get({
path: 'api/platforminfo'
})
}
export async function createAuthToken (tokenExpiringTime) {
const response = await post({
resource: 'authtokens',

@ -24,7 +24,6 @@ import {
} from '../api/subscriber'
import { deleteJwt, getJwt, getSubscriberId, setJwt, setSubscriberId } from 'src/auth'
import { setSession } from 'src/storage'
import { get } from 'src/api/common'
import QRCode from 'qrcode'
import {
qrPayload
@ -236,6 +235,7 @@ export default {
state.subscriber = options.subscriber
state.capabilities = options.capabilities
state.resellerBranding = options.resellerBranding
state.platformInfo = options.platformInfo
state.userDataSucceeded = true
state.userDataRequesting = false
@ -318,9 +318,6 @@ export default {
setProfile (state, value) {
state.profile = value
},
platformInfo (state, payload) {
state.platformInfo = payload
},
setQrCode (state, qrCode) {
state.qrCode = qrCode
},
@ -373,9 +370,6 @@ export default {
const profile = await getSubscriberProfile(userData.subscriber.profile_id)
context.commit('setProfile', profile)
}
context.commit('platformInfo', await get({
path: 'api/platforminfo'
}))
await context.dispatch('forwardHome')
} catch (err) {
console.debug(err)

Loading…
Cancel
Save