Organizando y comenzando con interfaces
This commit is contained in:
21
resources/views/components/flash.blade.php
Normal file
21
resources/views/components/flash.blade.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<div>
|
||||
<script>
|
||||
document.addEventListener('alpine:initialized', () => {
|
||||
const toast = @js(session()->get('toast', null));
|
||||
|
||||
if (!toast) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (toast.type === 'success') {
|
||||
$interaction('toast').success(toast.title ?? 'Éxito', toast.message).send();
|
||||
} else if (toast.type === 'error') {
|
||||
$interaction('toast').error(toast.title ?? 'Error', toast.message).send();
|
||||
} else if (toast.type === 'warning') {
|
||||
$interaction('toast').warning(toast.title ?? 'Advertencia', toast.message).send();
|
||||
} else if (toast.type === 'info') {
|
||||
$interaction('toast').info(toast.title ?? 'Información', toast.message).send();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
Reference in New Issue
Block a user