ike-weblca-html 2.2.17 → 2.2.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ike-weblca-html",
3
- "version": "2.2.17",
3
+ "version": "2.2.19",
4
4
  "description": "weblca-html-header&footer",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -1,5 +1,6 @@
1
- import {css, html, LitElement} from 'lit-element';
2
- import {property} from "lodash-es";
1
+ import {css, html, LitElement} from 'lit-element';
2
+ import {property} from "lodash-es";
3
+ import { getResponseErrorMessage, notifyRequestError } from './js/requestError'
3
4
 
4
5
  export class IkeWebFooter extends LitElement {
5
6
  static styles = css`
@@ -336,8 +337,13 @@ export class IkeWebFooter extends LitElement {
336
337
  async fetchData() {
337
338
  try {
338
339
  const response = await fetch(this._getOrganizationByDomainUrl());
339
- const jsonData = await response.json();
340
- let data = jsonData.data; // 将获取到的数据保存到 data 属性中
340
+ const jsonData = await response.json();
341
+ const errorMessage = getResponseErrorMessage(response, jsonData, '获取机构配置失败');
342
+ if (errorMessage) {
343
+ notifyRequestError(errorMessage);
344
+ return;
345
+ }
346
+ let data = jsonData.data; // 将获取到的数据保存到 data 属性中
341
347
  if (data && data.personalizedConfigJson) {
342
348
  this.personalizedConfigJson = JSON.parse(data.personalizedConfigJson);
343
349
  }
@@ -353,8 +359,8 @@ export class IkeWebFooter extends LitElement {
353
359
  setTimeout(() => this.requestUpdate(), 1000)
354
360
 
355
361
  // this.requestUpdate(); // 更新组件以触发重新渲染
356
- } catch (error) {
357
- // console.error('Error fetching data:', error);
362
+ } catch (error) {
363
+ notifyRequestError('获取机构配置失败');
358
364
  }
359
365
  }
360
366