mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-09 02:54:23 +01:00
18 lines
493 B
TypeScript
18 lines
493 B
TypeScript
|
|
import { createContext } from 'react';
|
||
|
|
import type { TShowToast } from '~/common';
|
||
|
|
import { useToast } from '~/hooks';
|
||
|
|
|
||
|
|
type ToastContextType = {
|
||
|
|
showToast: ({ message, severity, showIcon }: TShowToast) => void;
|
||
|
|
};
|
||
|
|
|
||
|
|
export const ToastContext = createContext<ToastContextType>({
|
||
|
|
showToast: () => ({}),
|
||
|
|
});
|
||
|
|
|
||
|
|
export default function ToastProvider({ children }) {
|
||
|
|
const { showToast } = useToast();
|
||
|
|
|
||
|
|
return <ToastContext.Provider value={{ showToast }}>{children}</ToastContext.Provider>;
|
||
|
|
}
|