@@ -321,9 +321,8 @@ function resetAccountingPreferredExporter(policyID: string, loginList: string[])
321321 if ( ! adminLoginList . length ) {
322322 return { optimisticData, successData, failureData} ;
323323 }
324-
325324 for ( const connection of connections ) {
326- const exporter = policy ?. connections ?. [ connection ] ?. config . export . exporter ;
325+ const exporter = policy ?. connections ?. [ connection ] ?. config ? .export ? .exporter ;
327326 if ( ! exporter || ! adminLoginList . includes ( exporter ) ) {
328327 continue ;
329328 }
@@ -357,7 +356,7 @@ function resetAccountingPreferredExporter(policyID: string, loginList: string[])
357356 connections : {
358357 [ connection ] : {
359358 config : {
360- export : { exporter : policy ?. connections ?. [ connection ] ?. config . export . exporter } ,
359+ export : { exporter} ,
361360 pendingFields : { [ pendingFieldKey ] : null } ,
362361 } ,
363362 } ,
@@ -366,7 +365,7 @@ function resetAccountingPreferredExporter(policyID: string, loginList: string[])
366365 } ) ;
367366 }
368367
369- const exporter = policy ?. connections ?. netsuite ?. options . config . exporter ;
368+ const exporter = policy ?. connections ?. netsuite ?. options ? .config ? .exporter ;
370369 if ( exporter && adminLoginList . includes ( exporter ) ) {
371370 optimisticData . push ( {
372371 onyxMethod : Onyx . METHOD . MERGE ,
@@ -385,7 +384,7 @@ function resetAccountingPreferredExporter(policyID: string, loginList: string[])
385384 failureData . push ( {
386385 onyxMethod : Onyx . METHOD . MERGE ,
387386 key : policyKey ,
388- value : { connections : { netsuite : { options : { config : { exporter : policy ?. connections ?. netsuite ?. options . config . exporter , pendingFields : { exporter : null } } } } } } ,
387+ value : { connections : { netsuite : { options : { config : { exporter, pendingFields : { exporter : null } } } } } } ,
389388 } ) ;
390389 }
391390
0 commit comments