Commit 049550be authored by 崔佳豪's avatar 崔佳豪

fix: 宿主配置容错处理

parent 0d6ade17
Pipeline #66962 passed with stages
...@@ -188,7 +188,7 @@ class Login { ...@@ -188,7 +188,7 @@ class Login {
const self = this; const self = this;
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
// 获取网站配置的同时,预先获取到mqtt配置,注册进子应用 // 获取网站配置的同时,预先获取到mqtt配置,注册进子应用
Promise.all([ Promise.allSettled([
noticeService.getMqttSiteCode({ 'request.preventCache': Date.now() }), noticeService.getMqttSiteCode({ 'request.preventCache': Date.now() }),
getWebSiteConfig({ getWebSiteConfig({
client: self.globalConfig.client, client: self.globalConfig.client,
...@@ -197,7 +197,9 @@ class Login { ...@@ -197,7 +197,9 @@ class Login {
}), }),
]) ])
.then(results => { .then(results => {
const res = results[0] || {}; const promise = results[0];
if (promise.status === 'rejected') return results;
const res = promise.value || {};
if (res && res.code === 0) { if (res && res.code === 0) {
const mqttConfig = { const mqttConfig = {
mqtt_mess: {}, mqtt_mess: {},
...@@ -243,7 +245,7 @@ class Login { ...@@ -243,7 +245,7 @@ class Login {
return results; return results;
}) })
.then(results => { .then(results => {
const response = results[1] ?? {}; const response = results[1]?.value ?? {};
const result = const result =
response && response.code === SERVICE_INTERFACE_SUCCESS_CODE response && response.code === SERVICE_INTERFACE_SUCCESS_CODE
? Array.isArray(response.data) ? Array.isArray(response.data)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment