Skip to content

Commit

Permalink
fix type
Browse files Browse the repository at this point in the history
Signed-off-by: Darren Kellenschwiler <d.kellenschwiler@bsvblockchain.org>
  • Loading branch information
sirdeggen committed Apr 3, 2024
1 parent 5609cb9 commit 4ceefcb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/paymailRouter/paymailRoutes/paymailRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface PaymailRouteConfig {
domainLogicHandler: RequestHandler
}

export type DomainLogicHandler = (name: string, domain: string, body?: any, pubkey?: string) => Promise<any>
export type DomainLogicHandler = (params: any, body?: any, pubkey?: string) => Promise<any>

export default class PaymailRoute {
private readonly capability: Capability
Expand Down Expand Up @@ -36,7 +36,8 @@ export default class PaymailRoute {
if (!req.params.paymail) {
throw new PaymailBadRequestError('Paymail handle is required.')
}
const response = await this.domainLogicHandler(req.params, req.body)
const parsedBody = JSON.parse(req.body ?? {})
const response = await this.domainLogicHandler(req.params, parsedBody)
const serializedResponse = this.serializeResponse(response)
return this.sendSuccessResponse(res, serializedResponse)
} catch (error) {
Expand Down

0 comments on commit 4ceefcb

Please sign in to comment.