Skip to content

Commit

Permalink
hack: workaround multirow ux
Browse files Browse the repository at this point in the history
  • Loading branch information
ogp-weeloong committed Nov 10, 2023
1 parent 0828c1f commit ecdd6b7
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IJSONArray, IJSONObject, IRawAction } from '@plumber/types'
import type { IJSONObject, IRawAction } from '@plumber/types'

import getApiBaseUrl from '../../common/get-api-base-url'

Expand Down Expand Up @@ -35,7 +35,12 @@ function constructPayload(parameters: IJSONObject): CreatePaymentPayload {
payload['return_url'] = parameters.returnUrl as string
}

const metadata = parameters.metadata as IJSONArray | null
// FIXME (ogp-weeloong): by default, we populate metadata with 1 empty row
// even if its optional, for UX reasons. for now, account for this case in
// code until we make the necessary UX changes to not need that 1 empty row.
const metadata = ((parameters.metadata as IJSONObject[] | null) ?? []).filter(
(metadatum) => !!metadatum.key,
)
if (metadata?.length) {
for (const metadatum of metadata) {
const { key, value } = metadatum as { key: string; value: string }
Expand Down

0 comments on commit ecdd6b7

Please sign in to comment.