saleor-apps-redis_apl/apps/data-exporter/src/modules/feed-url/use-get-feed-api-url.tsx

14 lines
384 B
TypeScript
Raw Normal View History

2023-09-18 07:28:01 +00:00
import { useAppBridge } from "@saleor/app-sdk/app-bridge";
export const useGetFeedApiUrl = (channelSlug: string) => {
const { appBridgeState } = useAppBridge();
if (!appBridgeState || !window.location.origin) {
return null;
}
return `${window.location.origin}/api/feed/${encodeURIComponent(
appBridgeState.saleorApiUrl as string
)}/${channelSlug}/google.xml`;
};