feat: order view status polling feature (#74)
Some checks failed
it-academy/dry-wash-pl/pipeline/pr-main There was a failure building this commit

This commit is contained in:
RustamRu 2025-01-26 19:28:23 +03:00 committed by ilnaz
parent 257f14de1a
commit 52c35be000
3 changed files with 23 additions and 0 deletions

View File

@ -21,6 +21,7 @@ module.exports = {
features: {
'dry-wash-pl': {
// add your features here in the format [featureName]: { value: string }
'order-view-status-polling': { value: '3000' }
},
},
config: {

15
src/__data__/features.ts Normal file
View File

@ -0,0 +1,15 @@
import { getFeatures } from "@brojs/cli";
const features = getFeatures('dry-wash-pl');
export const FEATURE = {
orderViewStatusPolling: {
isOn: Boolean(features['order-view-status-polling']),
getValue: () => {
const interval = parseInt(features['order-view-status-polling'].value);
if (!Number.isNaN(interval)) {
return interval;
}
}
}
};

View File

@ -20,6 +20,7 @@ import { OrderDetails } from '../../components/order-view';
import { Order } from '../../models/landing';
import { landingApi } from '../../__data__/service/landing.api';
import { ErrorMessage } from '../../models/api';
import { FEATURE } from '../../__data__/features';
const Page: FC = () => {
const { t } = useTranslation('~', {
@ -37,6 +38,12 @@ const Page: FC = () => {
{
orderId,
},
FEATURE.orderViewStatusPolling.isOn
? {
pollingInterval: FEATURE.orderViewStatusPolling.getValue(),
skipPollingIfUnfocused: true,
}
: undefined,
);
const errorMessage = error as ErrorMessage;