From 01d233084ff7da625c58059e60d7fedb749e9783 Mon Sep 17 00:00:00 2001 From: alan Date: Fri, 10 May 2019 17:44:36 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/link_set/link-set.model.ts | 2 +- src/app/link_set/link-set.service.ts | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/app/link_set/link-set.model.ts b/src/app/link_set/link-set.model.ts index d99f317..bde5261 100644 --- a/src/app/link_set/link-set.model.ts +++ b/src/app/link_set/link-set.model.ts @@ -34,7 +34,7 @@ const Model: ModelType = { onIconClick(title: string, id: string) { switch (title) { case '删除': - deleteConnection(id, (res: string) => { + deleteConnection(id, () => { this.model.linkList = [...this.model.linkList.filter((item: LinkType) => item.connectionId !== id)]; this.model.linkSelected = {}; this.model.linkUpdate = {}; diff --git a/src/app/link_set/link-set.service.ts b/src/app/link_set/link-set.service.ts index 4befbe1..11a418b 100644 --- a/src/app/link_set/link-set.service.ts +++ b/src/app/link_set/link-set.service.ts @@ -4,15 +4,23 @@ import {addConnection, updateConnection} from '@shared/crud/crud.request'; export function saveConnection(linkUpdate: LinkType): Promise { if (linkUpdate.connectionId) { return new Promise(((resolve, reject) => { - addConnection(linkUpdate, (res: string) => { - resolve(res); - }); + try { + addConnection(linkUpdate, (res: string) => { + resolve(res); + }); + } catch (error) { + reject(error); + } })); } return new Promise(((resolve, reject) => { - updateConnection(linkUpdate, (res: string) => { - resolve(res); - }); + try { + updateConnection(linkUpdate, (res: string) => { + resolve(res); + }); + } catch (error) { + reject(error); + } })); }