@fakel/rest-admin
Version:
An application that makes it easier to work with your API
24 lines (19 loc) • 492 B
text/typescript
import { notification } from "antd";
import { IconType } from "antd/lib/notification";
type useNotificationParamsT = {
message: string;
description?: string;
type?: IconType;
duration?: number;
};
export const useNotification = (params: useNotificationParamsT) => {
const { message, description, type = "info" } = params;
const openNotification = () => {
notification[type]({
message,
description,
duration: 0,
});
};
return openNotification;
};