notifications feathericons

This commit is contained in:
2023-02-19 18:29:09 +01:00
parent cb28767783
commit e765fed019
17 changed files with 80 additions and 125 deletions

View File

@ -3,12 +3,12 @@ import { Link } from "react-router-dom";
import {upload as ApiUpload} from "../services/PhpApi";
import PreviewUpload from "./PreviewUpload";
import './InputForm.css';
import { notificationError, notificationSuccess } from "../services/Notifications";
const FileUpload: React.FC = () =>
{
const [currentFile, setCurrentFile] = useState<File>();
const [progress, setProgress] = useState(0);
const [message, setMessage] = useState("");
const selectFile = (pl: File) =>
@ -28,7 +28,7 @@ const FileUpload: React.FC = () =>
})
.then((response) =>
{
setMessage(response.data.message);
notificationSuccess(response.data.message);
return;
})
.catch((err) =>
@ -37,11 +37,11 @@ const FileUpload: React.FC = () =>
if (err.response && err.response.data && err.response.data.message)
{
setMessage(err.response.data.message);
notificationError(err.response.data.message);
}
else
{
setMessage("Could not upload the File!");
notificationError("Could not upload the File!");
}
setCurrentFile(undefined);
@ -82,11 +82,6 @@ const FileUpload: React.FC = () =>
</div>
)}
{message && (
<div className="alert alert-secondary mt-3" role="alert">
{message}
</div>
)}
<Link to={"/profil"}>Zurück zum Profil</Link>
</div>