aboutsummaryrefslogtreecommitdiff
path: root/src/views/login/register.js
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-12-04 21:37:52 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-12-04 21:37:52 +0530
commit1139da4da7f1bb0ee4a66d420e690beed36832c2 (patch)
treeb0e5fca2f13c691b0c42543d98a747289f527e52 /src/views/login/register.js
parentbb38d843de17bb0b206a663e008c5dbb37f04708 (diff)
added notification system
Diffstat (limited to 'src/views/login/register.js')
-rw-r--r--src/views/login/register.js17
1 files changed, 14 insertions, 3 deletions
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 (