* 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
39 lines
818 B
TypeScript
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;
|