From 5ab21b4e655605ed716148641c88f958a51a0160 Mon Sep 17 00:00:00 2001 From: emmanuelonwukwe Date: Thu, 5 Oct 2023 15:30:02 +0100 Subject: [PATCH] Convert the handleLoginForm to async and await for fetch api --- src/App.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/App.js b/src/App.js index de748e4..e3eaf2f 100644 --- a/src/App.js +++ b/src/App.js @@ -11,12 +11,12 @@ function App() { const emailInputRef = useRef() const passwordInputRef = useRef() - function handleLoginForm() { + async function handleLoginForm() { const email = emailInputRef.current.value const password = passwordInputRef.current.value const hashedPassword = bcrypt.hashSync(password, '$2a$10$CwTycUXWue0Thq9StjUM0u') // hash created previously created upon sign up - fetch('https://api.sampleapis.com/beers/ale', { +await fetch('https://api.sampleapis.com/beers/ale', { method: 'POST', headers: { Accept: 'application/json',