Commit 0312644d authored by Alfonso Rafael Solis Rangel's avatar Alfonso Rafael Solis Rangel
Browse files

Trayendo el error desde el backend

parent a2d59f61
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
@@ -26,4 +26,37 @@
            </form>
        </div>
    </div>

    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <link rel="stylesheet" href="/assets/css/jquery.toast.css">
    <script src="/assets/js/jquery.toast.js"></script>

    <script>
        function showToast(message, heading, icon) {
            $.toast({
                heading: heading,
                text: message,
                showHideTransition: 'slide',
                icon: icon,
                position: 'top-right',
                loader: false,
                hideAfter: 10000, 
                allowToastClose: true,
                textColor: '#676767',
            });
        }

        document.addEventListener('DOMContentLoaded', function() {
            @if(session('success'))
            // Muestra el mensaje de éxito utilizando showMessage
                showToast("{{ session('success') }}", 'Exito.', 'success')
            @endif

            @if($errors->any())
                @foreach($errors->all() as $error)
                    showToast(`{{ $error }}`, 'Error.', 'error');
                @endforeach
            @endif
        });
    </script>
</x-layout.default>
 No newline at end of file