File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,7 +17,11 @@ export default function Accounts({ match }) {
1717 const [ accounts , setAccounts ] = React . useState ( [ ] )
1818 React . useEffect ( ( ) => {
1919 API . get ( '/v1/getAccounts' )
20- . then ( res => setAccounts ( res . data . Accounts ) )
20+ . then ( res => {
21+ if ( res . data . Accounts ) {
22+ setAccounts ( res . data . Accounts )
23+ }
24+ } )
2125 } , [ ] )
2226
2327 const accountCreated = ( ...newAccounts ) => {
@@ -68,15 +72,15 @@ export default function Accounts({ match }) {
6872 < p > Alternatively, import an OFX or QFX file downloaded from your institution.</ p >
6973 </ Col >
7074 </ Row >
71- { accounts ? accounts . map ( a =>
75+ { accounts . map ( a =>
7276 < Row key = { a . AccountID } >
7377 < Col > { a . AccountDescription } </ Col >
7478 < Col className = "account-buttons" >
7579 < Link to = { `${ match . url } /edit/${ a . AccountID } ` } className = "btn btn-outline-secondary" > Edit</ Link >
7680 < Button variant = "outline-danger" onClick = { ( ) => deleteAccount ( a . AccountID ) } > Delete</ Button >
7781 </ Col >
7882 </ Row >
79- ) : null }
83+ ) }
8084 < Row >
8185 < Col className = "account-actions" >
8286 < Link to = { `${ match . url } /direct-connect` } className = "btn btn-primary add-direct" > Add new Direct Connect</ Link >
You can’t perform that action at this time.
0 commit comments