Skip to content

Commit

Permalink
LSPS1: Only update FAILED or COMPLETED order first time
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamkmr04 committed May 17, 2024
1 parent 8c4d6d2 commit bdac1fc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 7 additions & 2 deletions views/Settings/LSPS1/Order.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ export default class Orders extends React.Component<OrderProps, OrdersState> {
const { LSPStore, navigation } = this.props;
let temporaryOrder: any;
const id = navigation.getParam('orderId', null);
const orderShouldUpdate = navigation.getParam(
'orderShouldUpdate',
null
);

console.log('Looking for order in storage...');
EncryptedStorage.getItem('orderResponses')
Expand Down Expand Up @@ -92,8 +96,9 @@ export default class Orders extends React.Component<OrderProps, OrdersState> {
const result =
getOrderData?.result || getOrderData;
if (
result?.order_state === 'COMPLETED' ||
result?.order_state === 'FAILED'
(result?.order_state === 'COMPLETED' ||
result?.order_state === 'FAILED') &&
!orderShouldUpdate
) {
this.updateOrderInStorage(getOrderData);
}
Expand Down
5 changes: 4 additions & 1 deletion views/Settings/LSPS1/OrdersPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ export default class OrdersPane extends React.Component<
<TouchableOpacity
onPress={() =>
this.props.navigation.navigate('LSPS1Order', {
orderId: item.orderId
orderId: item.orderId,
orderShouldUpdate:
item?.state === 'FAILED' ||
item?.state === 'COMPLETED'
})
}
style={{
Expand Down

0 comments on commit bdac1fc

Please sign in to comment.