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.
26 lines
634 B
26 lines
634 B
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) => { |
|
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); |
|
} |
|
})); |
|
}
|
|
|