fix: restore Inertia rendering in development
This commit is contained in:
@@ -1,19 +1,23 @@
|
||||
import { usePage } from '@inertiajs/react';
|
||||
import { useEffect } from 'react';
|
||||
import { toast } from 'sonner';
|
||||
|
||||
export function FlashMessages() {
|
||||
const { flash } = usePage().props;
|
||||
type FlashMessagesProps = {
|
||||
flash?: {
|
||||
success?: string | null;
|
||||
error?: string | null;
|
||||
};
|
||||
};
|
||||
|
||||
export function FlashMessages({ flash }: FlashMessagesProps) {
|
||||
useEffect(() => {
|
||||
if (flash.success) {
|
||||
if (flash?.success) {
|
||||
toast.success(flash.success);
|
||||
}
|
||||
|
||||
if (flash.error) {
|
||||
if (flash?.error) {
|
||||
toast.error(flash.error);
|
||||
}
|
||||
}, [flash.error, flash.success]);
|
||||
}, [flash?.error, flash?.success]);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user