From 3d04de84fa148e30b82ff453aae78d73681e7c8c Mon Sep 17 00:00:00 2001
From: Peter Hoppe
Date: Thu, 16 Feb 2023 10:54:33 +0100
Subject: [PATCH] icons neu, toaster weg
---
src/components/Login.tsx | 35 ++++++++++---
src/components/Register.tsx | 97 ++++++++++++++++++++++++++++++-------
2 files changed, 108 insertions(+), 24 deletions(-)
diff --git a/src/components/Login.tsx b/src/components/Login.tsx
index b39b890..1ceb069 100644
--- a/src/components/Login.tsx
+++ b/src/components/Login.tsx
@@ -5,7 +5,6 @@ import {getUser, loginUser} from '../services/PhpApi'
import useSWR from 'swr';
import { PasswordInput, Stack, TextInput } from '@mantine/core';
import { showNotification } from '@mantine/notifications';
-//import {IonIcon} from '@ionic/react'
import { CheckCircledIcon, CrossCircledIcon, ExclamationTriangleIcon } from '@radix-ui/react-icons';
@@ -25,7 +24,13 @@ const Login = () =>
{
showNotification(
{
- icon: ,
+ icon:
+
,
color: 'red',
message: error.message
});
@@ -61,9 +66,15 @@ const Login = () =>
{
showNotification(
{
- icon: ,
+ icon:
+
,
color: 'orange',
- message: 'Please Fill in all Required Fields!'
+ message: 'Bitte alle Felder ausfüllen!'
});
return;
}
@@ -73,7 +84,13 @@ const Login = () =>
{
showNotification(
{
- icon: ,
+ icon:
+
,
color: 'green',
message: logResp.message
});
@@ -88,7 +105,13 @@ const Login = () =>
// else
showNotification(
{
- icon: ,
+ icon:
+
,
color: 'red',
message: logResp.message
});
diff --git a/src/components/Register.tsx b/src/components/Register.tsx
index 685c809..b5c5f44 100644
--- a/src/components/Register.tsx
+++ b/src/components/Register.tsx
@@ -1,8 +1,10 @@
import {useState} from 'react'
import {Link} from 'react-router-dom'
-import toast, { Toaster } from 'react-hot-toast';
import './InputForm.css';
import {registerUser} from '../services/PhpApi';
+import { PasswordInput, Stack, TextInput } from '@mantine/core';
+import { CheckCircledIcon, CrossCircledIcon, ExclamationTriangleIcon } from '@radix-ui/react-icons';
+import { showNotification } from '@mantine/notifications';
const Register = () =>
{
@@ -25,47 +27,106 @@ const Register = () =>
if(!Object.values(formData).every(val => val.trim() !== ''))
{
- toast.error('Bitte alle Felder ausfüllen!');
+ showNotification(
+ {
+ icon:
+
,
+ color: 'orange',
+ message: 'Bitte alle Felder ausfüllen!'
+ });
+
return;
}
if(formData.password !== formData.password2)
{
- toast.error('Bitte 2mal das gleiche Passwort eingeben!');
+ showNotification(
+ {
+ icon:
+
,
+ color: 'orange',
+ message: 'Bitte 2mal das gleiche Passwort eingeben!'
+ });
return;
}
const data = await registerUser(formData);
if(data.success)
{
- toast.success('Erfolgreich Registriert!');
+ showNotification(
+ {
+ icon:
+
,
+ color: 'green',
+ message: 'Erfolgreich Registriert!'
+ });
e.currentTarget.reset();
}
else if(!data.success && data.message)
{
- toast.error(data.message);
+ showNotification(
+ {
+ icon:
+
,
+ color: 'red',
+ message: data.message
+ });
}
}
return (