The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Rocket.Chat/client/contexts/ToastMessagesContext.ts

19 lines
533 B

import { createContext, useContext } from 'react';
export type ToastMessagePayload = {
type: 'success' | 'info' | 'warning' | 'error';
message: string | Error;
title?: string;
options?: object;
};
type ToastMessagesContextValue = {
dispatch: (payload: ToastMessagePayload) => void;
};
export const ToastMessagesContext = createContext<ToastMessagesContextValue>({
dispatch: () => undefined,
});
export const useToastMessageDispatch = (): ToastMessagesContextValue['dispatch'] =>
useContext(ToastMessagesContext).dispatch;