refactor(article): merubah cara mengirim notifikasi setelah create dan update
This commit is contained in:
parent
ad30631544
commit
d266acae85
@ -34,11 +34,9 @@ public function save(): void
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->dispatch('refreshDatatable');
|
$this->redirectRoute('studio.manage.article.index', [
|
||||||
|
'notification' => 'Artikel berhasil ditambahkan.',
|
||||||
$this->toast('Artikel berhasil ditambahkan.');
|
], navigate: true);
|
||||||
|
|
||||||
$this->redirectRoute('studio.manage.article.index');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render(): View
|
public function render(): View
|
||||||
|
|||||||
@ -29,9 +29,9 @@ public function save(): void
|
|||||||
|
|
||||||
$this->form->update();
|
$this->form->update();
|
||||||
|
|
||||||
$this->toast('Artikel berhasil diperbarui.');
|
$this->redirectRoute('studio.manage.article.index', [
|
||||||
|
'notification' => 'Artikel berhasil diperbarui.',
|
||||||
$this->redirectRoute('studio.manage.article.index');
|
], navigate: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render(): View
|
public function render(): View
|
||||||
|
|||||||
@ -17,6 +17,21 @@ class Index extends Component
|
|||||||
{
|
{
|
||||||
use WithAuthorization, WithConfirmation, WithSubscribeNotification, WithToast;
|
use WithAuthorization, WithConfirmation, WithSubscribeNotification, WithToast;
|
||||||
|
|
||||||
|
public function mount(): void
|
||||||
|
{
|
||||||
|
$hasNotification = request()->get('notification');
|
||||||
|
|
||||||
|
if ($hasNotification) {
|
||||||
|
$this->js(<<<'JS'
|
||||||
|
const url = new URL(window.location);
|
||||||
|
url.search = '';
|
||||||
|
window.history.replaceState({}, '', url);
|
||||||
|
JS);
|
||||||
|
|
||||||
|
$this->toast($hasNotification);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function delete(Article $article): void
|
public function delete(Article $article): void
|
||||||
{
|
{
|
||||||
$this->canOrAbort('delete article');
|
$this->canOrAbort('delete article');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user