【发布时间】:2018-05-29 13:00:15
【问题描述】:
在一个 vuejs 应用程序中,我试图从 ajax 调用的数据中初始化一个对象:
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
对象由调用返回导出,使所有设置为空。
在导出我的 const 之前如何等待通话?
【问题讨论】:
标签: javascript ajax vue.js axios