mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
feat: update EPP form
This commit is contained in:
@@ -12,7 +12,10 @@ export enum ConnectorProvider {
|
||||
|
||||
export interface Connector {
|
||||
provider: ConnectorProvider
|
||||
authData: object
|
||||
authData: Record<string, Record<string, string>>,
|
||||
|
||||
objURI?: { key: string, value: string }[],
|
||||
extURI?: { key: string, value: string }[]
|
||||
}
|
||||
|
||||
interface ConnectorResponse {
|
||||
@@ -28,6 +31,18 @@ export async function getConnectors(): Promise<ConnectorResponse> {
|
||||
}
|
||||
|
||||
export async function postConnector(connector: Connector) {
|
||||
|
||||
for (const key of ['objURI', 'extURI'] as (keyof Connector)[]) {
|
||||
if (key in connector) {
|
||||
const obj = connector[key] as { key: string, value: string }[]
|
||||
connector.authData[key] = obj.reduce((acc: { [key: string]: string }, x) => ({
|
||||
...acc,
|
||||
[x.key]: x.value
|
||||
}), {})
|
||||
delete connector[key]
|
||||
}
|
||||
}
|
||||
|
||||
const response = await request<Connector & { id: string }>({
|
||||
method: 'POST',
|
||||
url: 'connectors',
|
||||
|
||||
Reference in New Issue
Block a user