40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import { Dispatch, SetStateAction } from "react";
|
|
import { getXTargetHeaderInfo } from "../../../../network/ApiClient";
|
|
import { get } from "../../../../network/NetworkService";
|
|
import { ActionMetaData } from "../../../common/actions/GenericAction";
|
|
import {
|
|
AnalyticsFlowNameConstant,
|
|
AnalyticsMethodNameConstant,
|
|
GI,
|
|
} from "../../../common/constants";
|
|
import { CtaData } from "../../../common/interface";
|
|
import { ScreenData } from "../../../common/interface/widgets/screenData/ScreenData";
|
|
import {
|
|
handleErrorData,
|
|
handleResponseData,
|
|
} from "../../../common/screen/ScreenActionHandler";
|
|
import { ScreenActionTypes } from "../../../common/screen/ScreenActionTypes";
|
|
export const getMarketBenefitComparePageData = async (
|
|
screenMetaData: ActionMetaData,
|
|
setScreenData: Dispatch<SetStateAction<ScreenData | null>>,
|
|
) => {
|
|
const url = "market-benefit-compare";
|
|
return get<ApiResponse<CtaData>>(
|
|
url,
|
|
getXTargetHeaderInfo(GI.toLocaleUpperCase()),
|
|
)
|
|
.then(response => {
|
|
handleResponseData(setScreenData, response);
|
|
})
|
|
.catch(error => {
|
|
handleErrorData(
|
|
error,
|
|
setScreenData,
|
|
screenMetaData,
|
|
AnalyticsFlowNameConstant.GI_RN_BENEFIT_COMPARE,
|
|
AnalyticsMethodNameConstant.MARKET_BENEFIT_COMPARE_LIST,
|
|
ScreenActionTypes.FETCH_BENEFIT_COMPARE_LIST,
|
|
);
|
|
});
|
|
};
|