user.page.js 696 Bytes
require('admin/user.page.css');

function bind_delete_user() {
    const deleteFn = function() {
        const userId = $(this).data('id');

        $.ajax({
            method: 'post',
            url: '/admin/api/user/delete',
            data: {
                userId
            }
        })
        .then(() => {
            location.reload();
        });
    };

    $('.btn-delete-user').on('click', deleteFn);
}

function bind_export_user_list() {
    const exportFn = function() {
        window.open('/admin/api/user/exportUserList', '_blank');
    };

    $('.btn-export-user-list').on('click', exportFn);
}

(function() {
    bind_delete_user();
    bind_export_user_list();
}());