-
Notifications
You must be signed in to change notification settings - Fork 0
/
cart.js
33 lines (30 loc) · 1 KB
/
cart.js
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
33
import Link from "next/link";
import { useRouter } from "next/router";
import { useTranslation, Trans } from "next-i18next";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import { getCookies, getCookie, setCookie, deleteCookie } from "cookies-next";
import dynamic from "next/dynamic";
const CartAreaNoSSR = dynamic(() => import("../components/ui/CartArea"), {
ssr: false,
});
/** @param {import('next').InferGetServerSidePropsType<typeof getServerSideProps> } props */
export default function Cart(props) {
const router = useRouter();
const { t } = useTranslation("common");
return (
<>
<CartAreaNoSSR/>
</>
);
}
export async function getServerSideProps({ locale, req, res }) {
return {
props: {
...(await serverSideTranslations(locale, ["common"])),
...setCookie("test", "value", { req, res, maxAge: 60 * 6 * 24 }),
...getCookie("test", { req, res }),
...getCookies({ req, res }),
...deleteCookie("test", { req, res }),
},
};
}