|
|
|
@ -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) => { |
|
|
|
|
try { |
|
|
|
|
addConnection(linkUpdate, (res: string) => { |
|
|
|
|
resolve(res); |
|
|
|
|
}); |
|
|
|
|
} catch (error) { |
|
|
|
|
reject(error); |
|
|
|
|
} |
|
|
|
|
})); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return new Promise(((resolve, reject) => { |
|
|
|
|
try { |
|
|
|
|
updateConnection(linkUpdate, (res: string) => { |
|
|
|
|
resolve(res); |
|
|
|
|
}); |
|
|
|
|
} catch (error) { |
|
|
|
|
reject(error); |
|
|
|
|
} |
|
|
|
|
})); |
|
|
|
|
} |
|
|
|
|