Skip to content

Commit

Permalink
LSPS1: Filter orders according to backend
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamkmr04 committed May 22, 2024
1 parent f9ea1db commit 2eac6e7
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions views/Settings/LSPS1/OrdersPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import LoadingIndicator from '../../../components/LoadingIndicator';

import { themeColor } from '../../../utils/ThemeUtils';
import { localeString } from '../../../utils/LocaleUtils';
import BackendUtils from '../../../utils/BackendUtils';

import LSPStore from '../../../stores/LSPStore';
import { WarningMessage } from '../../../components/SuccessErrorMessage';
Expand Down Expand Up @@ -65,8 +66,20 @@ export default class OrdersPane extends React.Component<
JSON.parse(response)
);

// Extract required information from each order for display
const orders = decodedResponses.map((response) => ({
let selectedOrders;
if (BackendUtils.supportsLSPS1customMessage()) {
selectedOrders = decodedResponses.filter(
(response) => response?.uri
);
} else if (BackendUtils.supportsLSPS1rest()) {
selectedOrders = decodedResponses.filter(
(response) => response?.endpoint
);
} else {
selectedOrders = decodedResponses;
}

const orders = selectedOrders.map((response) => ({
orderId:
response?.order?.result?.order_id ||
response?.order?.order_id,
Expand Down

0 comments on commit 2eac6e7

Please sign in to comment.