Files
pingvin-share/frontend/src/utils/toast.util.tsx
Elias Schneider 653d72bcb9 feat: chunk uploads (#76)
* add first concept

* finished first concept

* allow 3 uploads at same time

* retry if chunk failed

* updated clean temporary files job

* fix throttling for chunk uploads

* update tests

* remove multer

* migrate from `MAX_FILE_SIZE` to `MAX_SHARE_SIZE`

* improve error handling if file failed to upload

* fix promise limit

* improve file progress
2023-01-09 11:43:48 +01:00

39 lines
818 B
TypeScript

import { NotificationProps, showNotification } from "@mantine/notifications";
import { TbCheck, TbX } from "react-icons/tb";
const error = (message: string, config?: Omit<NotificationProps, "message">) =>
showNotification({
icon: <TbX />,
color: "red",
radius: "md",
title: "Error",
message: message,
autoClose: true,
...config,
});
const axiosError = (axiosError: any) =>
error(axiosError?.response?.data?.message ?? "An unknown error occurred");
const success = (
message: string,
config?: Omit<NotificationProps, "message">
) =>
showNotification({
icon: <TbCheck />,
color: "green",
radius: "md",
title: "Success",
message: message,
autoClose: true,
...config,
});
const toast = {
error,
success,
axiosError,
};
export default toast;