diff --git a/backend/README.md b/backend/README.md index 0f28e769bad2f1a169caaa1cf002aa688aed8ddf..347de767cbe8190a674e3f00a4c0f00af7cc9aaf 100644 --- a/backend/README.md +++ b/backend/README.md @@ -23,4 +23,35 @@ https://docs.sqlalchemy.org/en/20/changelog/migration_20.html#migration-20-query {{ register_form.password_confirm( placeholder = "Confirm Password") }} {{ register_form.submit() }} </form> +``` + +```js + const handleRegister = async (e) => { + e.preventDefault(); + + try { + const response = await axios.post('http://127.0.0.1:5000/', { + username, + email, + password + }, { + headers: { + 'Content-Type': 'application/json', + 'Accept': 'application/json' + } + }); + + console.log('Login successful!', response.data); + // Redirect user to another page upon successful login + //history.push('/dashboard'); // Example: redirect to '/dashboard' route + + } catch (error) { + console.error('Login failed!', error); + // Handle login error, display message to the user, etc. + } + + console.log("Register attempt with username: " + username+ " and password:" +password); + // Redirect user to another page upon successful login + + }; ``` \ No newline at end of file