import React, { createContext, useState, useContext } from 'react'; import FlashNotification from '@/components/FlashNotification'; const NotificationContext = createContext(); export const NotificationProvider = ({ children }) => { const [notification, setNotification] = useState({ message: '', type: '', title: '', errorCode: '', }); const showNotification = ( message, type = 'info', title = '', errorCode = '' ) => { setNotification({ message, type, title, errorCode }); }; const clearNotification = () => { setNotification({ message: '', type: '', title: '', errorCode: '' }); }; return ( {notification.message && ( )} {children} ); }; export const useNotification = () => useContext(NotificationContext);