livewire-alert icon indicating copy to clipboard operation
livewire-alert copied to clipboard

Flash Notification not working properly

Open septianinet opened this issue 2 years ago • 3 comments

I want to say thank you for creating this package, this package really helpful. But i found a problem when i want to use flash notification. The store function was working well no error, but the notification flash isn't working properly, only redirect and then no flash notif is showing. Any solution with my issue? Here is my code : `public function store() { Leave::create([ 'karyawan_id' => auth()->user()->id, 'manager_id' => $this->manager->id, 'department_id' => auth()->user()->department_id, 'jenis_cuti' => $this->jenis_cuti, 'tanggal_pengajuan' => Carbon::now(), 'tanggal_cuti' => $this->startDate, 'tanggal_masuk' => $this->endDate, 'jumlah_hari' => $this->jumlah_hari, 'keperluan_cuti' => $this->keperluan_cuti, 'alamat_cuti' => $this->alamat_cuti, 'no_telp_cuti' => $this->no_telp_cuti, 'status_cuti' => 'PENDING', ]);

    $this->flash('success', 'Pengajuan cuti berhasil', [
        'position' => 'center',
        'timer' => 3000,
        'toast' => true,
    ], '/');
}

public function confirmation()
{
    $this->validate();

    $this->alert('warning', 'Kirim pengajuan cuti', [
        'position' => 'center',
        'timer' => '60000',
        'toast' => false,
        'showConfirmButton' => true,
        'onConfirmed' => 'store',
        'showCancelButton' => true,
        'onDismissed' => '',
        'cancelButtonText' => 'Batal',
        'confirmButtonText' => 'Ya',
    ]);
}`

septianinet avatar Aug 01 '22 04:08 septianinet

Hi @septianinet

How did you set it up? also, is there any error in the console?

jantinnerezo avatar Aug 03 '22 17:08 jantinnerezo

Have you found the solution? @septianinet @jantinnerezo

I have the same problem when I want to use flash notification. At first everything went well, but after a while it didn't work

akbaraffaruk avatar Oct 10 '22 04:10 akbaraffaruk

Hi @septianinet

Can you show me how did you set it up?

jantinnerezo avatar Oct 12 '22 06:10 jantinnerezo

Facing the same issue, I'm using the npm version of sweetalert2

import Swal from 'sweetalert2';

window.Swal = Swal;

The error is, (index):1048 Uncaught (in promise) ReferenceError: Swal is not defined

Working fine on alert() but not with flash()

madurapa avatar Dec 25 '23 16:12 madurapa

#137 will fix this issue

madurapa avatar Dec 25 '23 19:12 madurapa