File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 1+ import { parseObject } from "../../common/utils.mjs" ;
12import leaddyno from "../../leaddyno.app.mjs" ;
23
34export default {
@@ -76,7 +77,7 @@ export default {
7677 commission_amount_override : this . commissionAmount && parseFloat ( this . commissionAmount ) ,
7778 description : this . description ,
7879 reassign_affiliate : this . reassignAffiliate ,
79- line_items : this . lineItems ,
80+ line_items : parseObject ( this . lineItems ) ,
8081 } ,
8182 } ) ;
8283
Original file line number Diff line number Diff line change 1+ export const parseObject = ( obj ) => {
2+ if ( ! obj ) return undefined ;
3+
4+ if ( Array . isArray ( obj ) ) {
5+ return obj . map ( ( item ) => {
6+ if ( typeof item === "string" ) {
7+ try {
8+ return JSON . parse ( item ) ;
9+ } catch ( e ) {
10+ return item ;
11+ }
12+ }
13+ return item ;
14+ } ) ;
15+ }
16+ if ( typeof obj === "string" ) {
17+ try {
18+ return JSON . parse ( obj ) ;
19+ } catch ( e ) {
20+ return obj ;
21+ }
22+ }
23+ return obj ;
24+ } ;
You can’t perform that action at this time.
0 commit comments