You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
634 B
27 lines
634 B
6 years ago
|
import {LinkType} from '@ui/type';
|
||
|
import {addConnection, updateConnection} from '@shared/crud/crud.request';
|
||
|
|
||
|
export function saveConnection(linkUpdate: LinkType): Promise<string> {
|
||
|
if (linkUpdate.connectionId) {
|
||
|
return new Promise(((resolve, reject) => {
|
||
6 years ago
|
try {
|
||
|
addConnection(linkUpdate, (res: string) => {
|
||
|
resolve(res);
|
||
|
});
|
||
|
} catch (error) {
|
||
|
reject(error);
|
||
|
}
|
||
6 years ago
|
}));
|
||
|
}
|
||
|
|
||
|
return new Promise(((resolve, reject) => {
|
||
6 years ago
|
try {
|
||
|
updateConnection(linkUpdate, (res: string) => {
|
||
|
resolve(res);
|
||
|
});
|
||
|
} catch (error) {
|
||
|
reject(error);
|
||
|
}
|
||
6 years ago
|
}));
|
||
|
}
|