ca-mfe-page-scoring-ui
Version:
This is a react shell for the SPGI Platform MFE implementation
29 lines (26 loc) • 1.14 kB
text/typescript
import { constants, utils } from '@spglobal/ca-mfe-package-utils';
import { endpoints } from '@root/constants/endpoints';
import { createApi } from '@reduxjs/toolkit/query/react';
import { getCaHeader } from '@root/utils/common';
export const generateScoreApi = createApi({
reducerPath: 'generateScoreApi',
baseQuery: utils.serviceLayerAPI.fetchBaseQuery({
baseUrl: constants.endpoints.SERVICEHOST,
headers: { 'ca-datasource': getCaHeader() }
}),
endpoints: builder => ({
generateScoreTracker: builder.mutation({
query: data => utils.serviceLayerAPI.reduxPost(endpoints.GENERATE_SCORE_TRACKER_API, data)
}),
generateScore: builder.mutation({
query: data => utils.serviceLayerAPI.reduxPost(endpoints.GENERATE_SCORE_API, data)
}),
getRiskGaugeData: builder.mutation({
query: data => utils.serviceLayerAPI.reduxPost(endpoints.RISK_GAUGE_DATA, data)
})
})
});
export const { useGenerateScoreTrackerMutation,
useGenerateScoreMutation,
useGetRiskGaugeDataMutation
} = generateScoreApi;