|
|
|
@ -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); |
|
|
|
|
} |
|
|
|
|
})); |
|
|
|
|
} |
|
|
|
|