Bitte schreib eine Email:
diff --git a/src/components/Header.tsx b/src/components/Header.tsx
index 8646626..1dc01bb 100644
--- a/src/components/Header.tsx
+++ b/src/components/Header.tsx
@@ -2,7 +2,7 @@ import './Header.css';
import '../App.css';
import './InputForm.css';
import {logOut} from '../services/PhpApi'
-import { toast, Toaster } from 'react-hot-toast';
+import { notificationSuccess } from '../services/Notifications';
function Header()
@@ -10,14 +10,13 @@ function Header()
const logOutForm = () =>
{
logOut();
- toast.success("logged out!");
+ notificationSuccess("logged out!");
window.location.href = '/dog/';
}
return (
diff --git a/src/components/PasswordReset.tsx b/src/components/PasswordReset.tsx
index 301a7e5..4408910 100644
--- a/src/components/PasswordReset.tsx
+++ b/src/components/PasswordReset.tsx
@@ -1,9 +1,9 @@
import React, { useState } from 'react';
-import toast, { Toaster } from 'react-hot-toast';
import { Link, useParams } from 'react-router-dom';
import { passwordReset, getPwToken } from '../services/PhpApi';
import useSWR from 'swr';
import './InputForm.css';
+import { notificationError, notificationSuccess } from '../services/Notifications';
export default function PasswordReset()
{
@@ -31,7 +31,6 @@ export default function PasswordReset()
{
return(
-
Email nicht mehr gültig!
)
@@ -43,13 +42,13 @@ export default function PasswordReset()
if(!Object.values(formData).every(val => val.trim() !== ''))
{
- toast.error('Bitte alle Felder ausfüllen!');
+ notificationError('Bitte alle Felder ausfüllen!');
return;
}
if(formData.password1 !== formData.password2)
{
- toast.error('Bitte 2mal das gleiche Passwort eingeben!');
+ notificationError('Bitte 2mal das gleiche Passwort eingeben!');
return;
}
@@ -68,18 +67,17 @@ export default function PasswordReset()
const dataRes = await passwordReset(sendData);
if(dataRes.success)
{
- toast.success('Erfolgreich Passwort geändert!');
+ notificationSuccess('Erfolgreich Passwort geändert!');
e.currentTarget?.reset();
}
else if(!dataRes.success && dataRes.message)
{
- toast.error(dataRes.message);
+ notificationError(dataRes.message);
}
}
return (
-
Passwort zurücksetzten!
diff --git a/src/components/Profil.tsx b/src/components/Profil.tsx
index 48fef22..289a277 100644
--- a/src/components/Profil.tsx
+++ b/src/components/Profil.tsx
@@ -1,7 +1,6 @@
import React, { useRef, useState } from 'react';
import useSWR from 'swr';
import { Link } from 'react-router-dom';
-import toast, { Toaster } from 'react-hot-toast';
import {TUser} from '../context/UserContext';
import {getProfilData, updateDog} from '../services/PhpApi';
import CreateQr from '../services/CreateQr';
@@ -9,6 +8,7 @@ import Img from './Img';
import './InputForm.css';
import './Profil.css';
import { TextInput } from '@mantine/core';
+import { notificationError, notificationSuccess } from '../services/Notifications';
function Profil()
{
@@ -74,13 +74,14 @@ function Profil()
};
}
- const onChangeInput = (e: React.FormEvent
) =>
+ const onChangeInput = (e: React.FormEvent) =>
{
formData_loc =
{
...formData_loc,
- [e.currentTarget.name]:e.currentTarget.value
+ [e!.currentTarget.name]:e!.currentTarget.value
};
+
setFormData(formData_loc);
edit.current = true;
formDataSave.current = {...formData_loc};
@@ -90,21 +91,25 @@ function Profil()
{
if(data.success)
{
- toast.success('Daten geändert!');
+ notificationSuccess('Daten geändert!');
}
else if(!data.success && data.message)
{
- toast.error(data.message);
+ notificationError(data.message);
}
}
const submitForm = async (e: React.FormEvent) =>
{
e.preventDefault();
+ console.log(formData);
+ console.log(formData_loc);
+ console.log(formDataSave.current);
+
if(!Object.values(formData).every(val => val?.trim() !== ''))
{
- toast.error('Bitte alle Felder ausfüllen!');
+ notificationError('Bitte alle Felder ausfüllen!');
return;
}
setFormData(formData);
@@ -143,7 +148,6 @@ function Profil()
return (
-
Profil
diff --git a/src/components/WantNewPw.tsx b/src/components/WantNewPw.tsx
index 96ec406..abee320 100644
--- a/src/components/WantNewPw.tsx
+++ b/src/components/WantNewPw.tsx
@@ -1,6 +1,6 @@
import { TextInput } from '@mantine/core';
import React, { useState } from 'react'
-import toast, { Toaster } from 'react-hot-toast';
+import { notificationError, notificationSuccess } from '../services/Notifications';
import {wantNewPw} from '../services/PhpApi'
import './InputForm.css';
@@ -28,18 +28,17 @@ function WantNewPw()
const data = await wantNewPw({email: email});
if(data.success)
{
- toast.success('Passwort angefordert! Bitte Postfach ' + email + ' checken!');
+ notificationSuccess('Passwort angefordert! Bitte Postfach ' + email + ' checken!');
//e.currentTarget.reset();
}
else if(!data.success && data.message)
{
- toast.error(data.message);
+ notificationError(data.message);
}
}
return (