deleteCheckinModalをVanilla化

This commit is contained in:
shibafu
2020-08-07 00:53:36 +09:00
parent 8a0a29feef
commit 23189b76e4
4 changed files with 37 additions and 40 deletions

View File

@@ -1,6 +1,6 @@
import * as Cookies from 'js-cookie';
import { fetchPostJson, fetchDeleteJson, ResponseError } from './fetch';
import { linkCard, pageSelector } from './tissue';
import { linkCard, pageSelector, deleteCheckinModal } from './tissue';
require('./bootstrap');
@@ -24,11 +24,15 @@ $(() => {
document.querySelectorAll('.tis-page-selector').forEach(pageSelector);
document.querySelectorAll('.link-card').forEach(linkCard);
const $deleteCheckinModal = $('#deleteCheckinModal').deleteCheckinModal();
$(document).on('click', '[data-target="#deleteCheckinModal"]', function (event) {
event.preventDefault();
$deleteCheckinModal.modal('show', this);
});
const elDeleteCheckinModal = document.getElementById('deleteCheckinModal');
if (elDeleteCheckinModal) {
const $deleteCheckinModal = deleteCheckinModal(elDeleteCheckinModal);
$(document).on('click', '[data-target="#deleteCheckinModal"]', function (event) {
event.preventDefault();
$deleteCheckinModal.modal('show', this);
});
}
$(document).on('click', '[data-href]', function (_event) {
location.href = $(this).data('href');