set cookie

master
alex 2024-01-14 20:28:10 +01:00
parent 2e4297ab64
commit 6a331cde8f
1 changed files with 17 additions and 2 deletions

View File

@ -1,6 +1,10 @@
import { Button, Spin } from "antd"; import { Button, Spin } from "antd";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Constants, myFetch } from "../../../utils"; import {
Constants,
getUserSessionFromLocalStorage,
myFetch,
} from "../../../utils";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import MyCenteredContainer from "../../../Components/MyContainer"; import MyCenteredContainer from "../../../Components/MyContainer";
@ -33,7 +37,18 @@ export default function StoreCalendar() {
<> <>
<h1>{t("calendar.pageTitle")}</h1> <h1>{t("calendar.pageTitle")}</h1>
<Button href={`${Constants.API_ADDRESS}/calendar/auth/google`}> <Button
href={`${Constants.API_ADDRESS}/calendar/auth/google`}
onClick={() => {
const date = new Date();
date.setTime(date.getTime() + 5 * 60 * 1000);
document.cookie = `session=${getUserSessionFromLocalStorage()}; expires=${date.toUTCString()}; domain=${
window.location.hostname
} path=/;`;
}}
>
LOGIN with GOOGLE LOGIN with GOOGLE
</Button> </Button>
</> </>