Updating testConnection usage.
This commit is contained in:
parent
571987a2ce
commit
bd74f8eef7
|
@ -128,12 +128,20 @@ export async function verify(
|
|||
) {
|
||||
const datasource = ctx.request.body.datasource
|
||||
const connector = (await getConnector(datasource)) as IntegrationBase
|
||||
if (!connector.connection) {
|
||||
if (!connector.testConnection) {
|
||||
ctx.throw(400, "Connection information verification not supported")
|
||||
}
|
||||
const connectionInfo = await connector.connection()
|
||||
ctx.body = {
|
||||
connected: connectionInfo.connected,
|
||||
const response = await connector.testConnection()
|
||||
|
||||
if (typeof response === "boolean") {
|
||||
ctx.body = {
|
||||
connected: response,
|
||||
}
|
||||
} else {
|
||||
ctx.body = {
|
||||
connected: false,
|
||||
error: response.error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ export interface VerifyDatasourceRequest {
|
|||
|
||||
export interface VerifyDatasourceResponse {
|
||||
connected: boolean
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface UpdateDatasourceRequest extends Datasource {
|
||||
|
|
Loading…
Reference in New Issue