trying a different redirect for home to event-types

This commit is contained in:
Peer Richelsen 2021-08-02 20:04:06 +02:00
parent 9051a0d60e
commit 71fc0ba437

View file

@ -1,16 +1,19 @@
export default function Home() { import { useRouter } from "next/router";
return (
<div className="loader"> function RedirectPage() {
<span className="loader-inner"></span> const router = useRouter();
</div> if (typeof window !== "undefined") {
); router.push("/event-types");
return;
}
} }
export async function getStaticProps() { RedirectPage.getInitialProps = (ctx) => {
return { if (ctx.res) {
redirect: { ctx.res.writeHead(302, { Location: "/event-types" });
destination: "/event-types", ctx.res.end();
permanent: false,
},
};
} }
return {};
};
export default RedirectPage;