@@ -4,16 +4,16 @@ import * as API from '@libs/API';
44import { WRITE_COMMANDS } from '@libs/API/types' ;
55import CONST from '@src/CONST' ;
66import ONYXKEYS from '@src/ONYXKEYS' ;
7- import type { Policy } from '@src/types/onyx' ;
7+ import type { ACHAccount } from '@src/types/onyx/Policy ' ;
88
9- function resetNonUSDBankAccount ( policy : OnyxEntry < Policy > ) {
10- if ( ! policy ) {
9+ function resetNonUSDBankAccount ( policyID : string | undefined , achAccount : OnyxEntry < ACHAccount > ) {
10+ if ( ! policyID ) {
1111 throw new Error ( 'Missing policy when attempting to reset' ) ;
1212 }
1313
1414 API . write (
1515 WRITE_COMMANDS . RESET_BANK_ACCOUNT_SETUP ,
16- { policyID : policy . id } ,
16+ { policyID} ,
1717 {
1818 optimisticData : [
1919 {
@@ -28,7 +28,7 @@ function resetNonUSDBankAccount(policy: OnyxEntry<Policy>) {
2828 } ,
2929 {
3030 onyxMethod : Onyx . METHOD . MERGE ,
31- key : `${ ONYXKEYS . COLLECTION . POLICY } ${ policy . id } ` ,
31+ key : `${ ONYXKEYS . COLLECTION . POLICY } ${ policyID } ` ,
3232 value : {
3333 achAccount : null ,
3434 } ,
@@ -54,9 +54,9 @@ function resetNonUSDBankAccount(policy: OnyxEntry<Policy>) {
5454 } ,
5555 {
5656 onyxMethod : Onyx . METHOD . MERGE ,
57- key : `${ ONYXKEYS . COLLECTION . POLICY } ${ policy . id } ` ,
57+ key : `${ ONYXKEYS . COLLECTION . POLICY } ${ policyID } ` ,
5858 value : {
59- achAccount : policy ?. achAccount ,
59+ achAccount,
6060 } ,
6161 } ,
6262 ] ,
0 commit comments