diff --git a/kraken-app/kraken-app-portal/src/hooks/product/index.ts b/kraken-app/kraken-app-portal/src/hooks/product/index.ts index 68ff9d9ab..e466fecf4 100644 --- a/kraken-app/kraken-app-portal/src/hooks/product/index.ts +++ b/kraken-app/kraken-app-portal/src/hooks/product/index.ts @@ -373,6 +373,7 @@ export const useGetComponentDetailMapping = ( PRODUCT_CACHE_KEYS.get_component_detail_mapping, productId, componentId, + productType, ], queryFn: () => getComponentDetailMapping(productId, componentId, productType), diff --git a/kraken-app/kraken-app-portal/src/pages/StandardAPIMapping/index.tsx b/kraken-app/kraken-app-portal/src/pages/StandardAPIMapping/index.tsx index 9a0166129..517d18744 100644 --- a/kraken-app/kraken-app-portal/src/pages/StandardAPIMapping/index.tsx +++ b/kraken-app/kraken-app-portal/src/pages/StandardAPIMapping/index.tsx @@ -16,6 +16,7 @@ import buildInitListMapping from "@/utils/helpers/buildInitListMapping"; import groupByPath from "@/utils/helpers/groupByPath"; import { IMappers } from "@/utils/types/component.type"; import { IMapperDetails } from "@/utils/types/env.type"; +import { parseProductName } from "@/utils/helpers/name"; import { Flex, Spin, Button, Tooltip, notification, Drawer } from "antd"; import dayjs from "dayjs"; import { delay, get, isEmpty, chain, cloneDeep, flatMap, reduce } from "lodash"; @@ -35,14 +36,25 @@ import {getData} from "@/utils/helpers/token.ts"; const StandardAPIMapping = () => { const { currentProduct } = useAppStore(); - const { componentId } = useParams(); + const { componentId, targetKey } = useParams(); const location = JSON.parse(getData("currentLocation")??'{}'); - const [mainTitle, setMainTitle] = useState(() => location?.productType ?? "unknown main title"); const [filteredComponentList, setFilteredComponentList] = useState(() => location?.filteredComponentList ?? []); const [productType, setProductType] = useState(() => location?.productType ?? ""); + useEffect(() => { + if (!targetKey) { + return; + } + if (targetKey.includes("address")) { + setProductType("SHARE"); + } else if (targetKey.includes("uni")) { + setProductType("UNI"); + } else if (targetKey.includes("eline")) { + setProductType("ACCESS_E_LINE"); + } + }, [targetKey]); + const { activePath, setActivePath, selectedKey, setSelectedKey } = useMappingUiStore(); - const { setQuery, reset, @@ -64,10 +76,11 @@ const StandardAPIMapping = () => { currentProduct, componentId ?? "" ); + const { data: detailDataMapping, refetch } = useGetComponentDetailMapping( currentProduct, componentId ?? "", - productType + productType, ); const { value: isChangeMappingKey, setValue: setIsChangeMappingKey } = @@ -104,8 +117,6 @@ const StandardAPIMapping = () => { }; useEffect(() => { - // Silence unused setter warnings without changing state - setMainTitle((prev: string) => prev); setFilteredComponentList((prev: any[]) => prev); setProductType((prev: string) => prev); }, []); @@ -364,7 +375,7 @@ const StandardAPIMapping = () => { style={{ padding: "5px 0" }} > { ), }, ]; - return ( { export const parseProductValue = (product: string) => { return product.split(':').shift(); -}; \ No newline at end of file +};