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 21, 2023
1 parent d771d7d commit 5df8ceb
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 5df8ceb

Please sign in to comment.