Within my vuejs application, I am faced with the challenge of initializing an object using data retrieved from an ajax call:
let settings = {}
api.readConfig().then((config) => {
settings = {
userStore: new Oidc.WebStorageStateStore(),
authority: config.data.urls.auth,
client_id: config.data.clientid,
redirect_uri: `${window.location.protocol}//${window.location.hostname}${window.location.port ? `:${window.location.port}` : ''}${process.env.ROUTER_BASE}static/callback.html`,
response_type: 'id_token token',
post_logout_redirect_uri: config.data.urls.auth,
}
})
const authMgr = new Oidc.UserManager(settings)
export default authMgr
Upon exporting the object, all settings are null due to the asynchronous nature of the call.
I am seeking a solution on how to properly wait for the call to finish before exporting my constant.