feat: add connector api wrapper

This commit is contained in:
Maël Gangloff
2024-07-29 19:04:50 +02:00
parent f9c003fffb
commit e4da5413b4
3 changed files with 38 additions and 2 deletions

View File

@@ -0,0 +1,36 @@
import {request} from "./index";
enum ConnectorProvider {
OVH = 'ovh'
}
export type Connector = {
provider: ConnectorProvider
authData: object
}
export async function getConnectors() {
const response = await request({
url: 'connectors'
})
return response.data
}
export async function postConnector(connector: Connector) {
const response = await request<Connector & { id: string }>({
method: 'POST',
url: 'connectors',
data: connector,
headers: {
"Content-Type": 'application/json'
}
})
return response.data
}
export async function deleteConnector(token: string): Promise<void> {
await request({
method: 'DELETE',
url: 'connectors/' + token
})
}