From 1139da4da7f1bb0ee4a66d420e690beed36832c2 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sun, 4 Dec 2022 21:37:52 +0530 Subject: added notification system --- src/views/login/register.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/views/login/register.js') diff --git a/src/views/login/register.js b/src/views/login/register.js index c747f59..1b1755b 100644 --- a/src/views/login/register.js +++ b/src/views/login/register.js @@ -17,12 +17,15 @@ import './scss/login.scss'; import { User, validateEmail, validateUsername, validatePassword, saveUser } from '../../classes/user'; +import { notificationConfig } from "./../../classes/notifications"; +import { Store } from "react-notifications-component"; import { Link } from 'react-router-dom'; import { useState } from 'react'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faEye } from '@fortawesome/free-solid-svg-icons' + const RegisterPage = () => { const [user, setUser] = useState(new User()); const [showPassword, setShowPassword] = useState(false); @@ -41,11 +44,19 @@ const RegisterPage = () => { } const handleSuccess = () => { - alert("yay") + Store.addNotification({ + title: "Created new account", + message: `Welcome to OpenBills, ${user.UserName}!`, + ...notificationConfig("default") + }); } - const handleError = () => { - alert("fail") + const handleError = err => { + Store.addNotification({ + title: "An error occoured", + message: `Failed to create new account. ${err.message}`, + ...notificationConfig("danger") + }); } return ( -- cgit v1.2.3