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
Some checks failed
it-academy/dry-wash-pl/pipeline/pr-main There was a failure building this commit
This commit is contained in:
parent
257f14de1a
commit
52c35be000
@ -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
15
src/__data__/features.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user