cal.pub0.org/pages/index.tsx

23 lines
438 B
TypeScript
Raw Normal View History

import { useRouter } from "next/router";
2021-03-22 13:48:48 +00:00
import Loader from "@components/Loader";
function RedirectPage() {
const router = useRouter();
if (typeof window !== "undefined") {
router.push("/event-types");
return;
}
return <Loader />;
}
RedirectPage.getInitialProps = (ctx) => {
if (ctx.res) {
ctx.res.writeHead(302, { Location: "/event-types" });
ctx.res.end();
}
return {};
};
export default RedirectPage;