diff --git a/resources/assets/js/setting/webhooks.ts b/resources/assets/js/setting/webhooks.ts index 42933d2..748e6bb 100644 --- a/resources/assets/js/setting/webhooks.ts +++ b/resources/assets/js/setting/webhooks.ts @@ -16,14 +16,17 @@ $('.copy-to-clipboard').on('shown.bs.popover', function () { setTimeout(() => $(this).popover('hide'), 3000); }); -const $deleteModal = $('#deleteIncomingWebhookModal'); -$deleteModal.find('.btn-danger').on('click', function () { - const $form = $deleteModal.find('form'); - $form.attr('action', $form.attr('action')?.replace('@', $deleteModal.data('id')) || null); - $form.submit(); -}); -$('[data-target="#deleteIncomingWebhookModal"]').on('click', function (event) { - event.preventDefault(); - $deleteModal.data('id', $(this).data('id')); - $deleteModal.modal('show', this); -}); +const deleteModal = document.getElementById('deleteIncomingWebhookModal'); +if (deleteModal) { + let id: any = null; + deleteModal.querySelector('form')?.addEventListener('submit', function () { + this.action = this.action.replace('@', id); + }); + document.querySelectorAll('[data-target="#deleteIncomingWebhookModal"]').forEach((el) => { + el.addEventListener('click', function (e) { + e.preventDefault(); + id = this.dataset.id; + $(deleteModal).modal('show', this); + }); + }); +} diff --git a/resources/views/setting/webhooks.blade.php b/resources/views/setting/webhooks.blade.php index be18ce5..d9f4d08 100644 --- a/resources/views/setting/webhooks.blade.php +++ b/resources/views/setting/webhooks.blade.php @@ -54,13 +54,13 @@ 削除確認 @endslot Webhookを削除してもよろしいですか? -
- {{ csrf_field() }} - {{ method_field('DELETE') }} -
@slot('footer') - - +
+ {{ csrf_field() }} + {{ method_field('DELETE') }} + + +
@endslot @endcomponent @endsection