Browse Source

style: 调整代码结构

master
alan 6 years ago
parent
commit
01d233084f
  1. 2
      src/app/link_set/link-set.model.ts
  2. 20
      src/app/link_set/link-set.service.ts

2
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 = {};

20
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<string> {
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);
}
}));
}

Loading…
Cancel
Save