Update
This commit is contained in:
23
resources/js/modules/flash/flash-messages.jsx
Normal file
23
resources/js/modules/flash/flash-messages.jsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import { usePage } from '@inertiajs/react';
|
||||
import { useEffect } from 'react';
|
||||
import { toast } from 'sonner';
|
||||
|
||||
const FlashMessages = () => {
|
||||
const { flash } = usePage().props;
|
||||
|
||||
useEffect(() => {
|
||||
if (flash.message) {
|
||||
toast.success(flash.message);
|
||||
}
|
||||
|
||||
if (flash.error) {
|
||||
toast.error(flash.error);
|
||||
}
|
||||
|
||||
if (flash.success) {
|
||||
toast.success(flash.success);
|
||||
}
|
||||
}, [flash]);
|
||||
};
|
||||
|
||||
export default FlashMessages;
|
||||
Reference in New Issue
Block a user