saleor-apps-redis_apl/apps/klaviyo/src/pages/index.tsx

33 lines
899 B
TypeScript
Raw Normal View History

import { NextPage } from "next";
import { useAppBridge } from "@saleor/app-sdk/app-bridge";
import { useEffect } from "react";
import { useIsMounted } from "usehooks-ts";
import { useRouter } from "next/router";
import { isInIframe } from "@saleor/apps-shared";
const IndexPage: NextPage = () => {
const { appBridgeState } = useAppBridge();
const isMounted = useIsMounted();
const { replace } = useRouter();
useEffect(() => {
if (isMounted() && appBridgeState?.ready) {
replace("/configuration");
}
}, [isMounted, appBridgeState?.ready, replace]);
if (isInIframe()) {
return <span>Loading...</span>;
}
return (
<div>
<h1>Saleor Klaviyo</h1>
<p>This is Saleor App that allows to use external service to handle taxes.</p>
<p>Install the app in your Saleor instance and open it in Dashboard.</p>
</div>
);
};
export default IndexPage;