From 5d4b0ed783decd560457d01ca644275625a1e8ac Mon Sep 17 00:00:00 2001 From: Tobias Mahnke Date: Tue, 20 Apr 2021 17:19:29 +0200 Subject: [PATCH] feat: display registration success response --- frontend/src/pages/RegistrationPage.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/RegistrationPage.tsx b/frontend/src/pages/RegistrationPage.tsx index e007151..0fde7d3 100644 --- a/frontend/src/pages/RegistrationPage.tsx +++ b/frontend/src/pages/RegistrationPage.tsx @@ -9,12 +9,16 @@ import type { RootState } from '../store'; const RegistrationPage = connect((state: RootState) => ({ loggedIn: Boolean(state.login) }))(function RegistrationPage({ loggedIn, }) { + const [message, setMessage] = React.useState(); + const onSubmit = React.useCallback(async ({ username, email, password }) => { const response = await api.post(`/accounts/register`, { body: { username, email, password, confirmPassword: password }, }); - console.log('response', response); + if (response && response.message) { + setMessage(response.message); + } }, []); return loggedIn ? ( @@ -22,7 +26,7 @@ const RegistrationPage = connect((state: RootState) => ({ loggedIn: Boolean(stat ) : (

Register

- + {message ? message : }
); });