aboutsummaryrefslogtreecommitdiff
path: root/pages/index.js
blob: 6f020fbff98aeafc27103a087a9b03718c93686c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { parseCookies } from "nookies";

export default function Home() {
  return <></>;
}

export async function getServerSideProps(context) {
  const cookie = parseCookies(context);

  if (cookie.lang === "en") {
    return {
      redirect: {
        destination: "/en",
        permanent: false,
      },
    };
  } else if (cookie.lang === "id") {
    return {
      redirect: {
        destination: "/id",
        permanent: false,
      },
    };
  } else {
    return {
      redirect: {
        destination: "/en",
        permanent: false,
      },
    };
  }
}