From 782d412d4f0ebe09e98503a71e0b290beb71d5a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Faure?= <raphael.faure2@student-cs.fr> Date: Thu, 1 Dec 2022 16:29:25 +0100 Subject: [PATCH] Add cookie --- client/src/App.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/client/src/App.js b/client/src/App.js index 48ecf9b..553a038 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -1,13 +1,13 @@ import './styles/App.css'; import React, { useState } from "react"; - import { useParams } from "react-router-dom"; import Connected from './pages/Connected'; import { toast } from "react-toastify"; import { ToastContainer } from "react-toastify" import 'react-toastify/dist/ReactToastify.css'; import { useNavigate, useLocation } from "react-router-dom"; +import { Cookies, useCookies } from 'react-cookie' @@ -17,7 +17,11 @@ function App(props) { const { code } = useParams(); const { search } = useLocation(); let url = new URLSearchParams(search) - + const [cookies, setCookie] = useCookies(['once']) + let d = new Date() + d.setTime(d.getTime() + 60); + setCookie('is', '1', { path: "/", d }); + console.log(cookies); const onSubmit = (e) => { const tagger = { @@ -56,8 +60,6 @@ function App(props) { ) } - - } export default App; -- GitLab