Merge branch 'react-version' of https://github.com/MarcEricMartel/420-5DW-HY-TP into react-version
This commit is contained in:
@@ -10,6 +10,7 @@ import { useCookies } from "react-cookie";
|
||||
const Topbar = () => {
|
||||
const [cookies, setCookie, removeCookie] = useCookies(['name']);
|
||||
const [user, setLogin] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
async function reset() {
|
||||
await setLogin(await cookies.GMGM ?? null);
|
||||
@@ -22,9 +23,8 @@ const Topbar = () => {
|
||||
method: 'POST',
|
||||
credentials: 'include'
|
||||
})
|
||||
|
||||
await removeCookie("GMGM");
|
||||
await setLogin(null); // Y U NO WORK?!?
|
||||
await removeCookie("GMGM");
|
||||
await setLogin(null); // Y U NO WORK?!?
|
||||
}
|
||||
|
||||
return (
|
||||
|
@@ -25,7 +25,17 @@ import { useForm } from "react-hook-form";
|
||||
|
||||
export default function App() {
|
||||
const { register, handleSubmit, watch, formState: { errors } } = useForm();
|
||||
const onSubmit = data => console.log(data);
|
||||
const onSubmit = data => {
|
||||
const response = fetch(`https://localhost:7292/api/User`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Accept': 'text/json',
|
||||
'Content-Type': 'text/json'
|
||||
},
|
||||
body: JSON.stringify(data)
|
||||
})
|
||||
|
||||
}
|
||||
return (
|
||||
<div className="inventaire-form-container">
|
||||
<form onSubmit={handleSubmit(onSubmit)}>
|
||||
|
Reference in New Issue
Block a user