diff --git a/src/api/user.js b/src/api/user.js index be8e3c21..1b3eb750 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -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', diff --git a/src/store/user.js b/src/store/user.js index 40611088..2e634f23 100644 --- a/src/store/user.js +++ b/src/store/user.js @@ -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)