From 80c3c48248cf0cb398566ace93dd4771d293f63b Mon Sep 17 00:00:00 2001 From: Saner Date: Fri, 23 Nov 2018 15:38:52 +0800 Subject: [PATCH] fix --- resources/views/index.blade.php | 74 +++++++++++++++++---------------- 1 file changed, 39 insertions(+), 35 deletions(-) diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php index 80fcc44..723f9f6 100644 --- a/resources/views/index.blade.php +++ b/resources/views/index.blade.php @@ -111,23 +111,25 @@ title: "Delete key ["+key+"] ?", type: "error", showCancelButton: true - }, - function(){ - var params = { - conn: "{{ $conn }}", - key: key, - _token: LA.token - }; - - $.ajax({ - url: '{{ route('redis-key-delete') }}', - type: 'DELETE', - data: params, - success: function(result) { - toastr.success('Key '+key+' deleted'); - $.pjax.reload('#pjax-container'); - } - }); + }).then(function (result) { + if (result.value) { + + var params = { + conn: "{{ $conn }}", + key: key, + _token: LA.token + }; + + $.ajax({ + url: '{{ route('redis-key-delete') }}', + type: 'DELETE', + data: params, + success: function (result) { + toastr.success('Key ' + key + ' deleted'); + $.pjax.reload('#pjax-container'); + } + }); + } }); }); @@ -143,24 +145,26 @@ function(){ title: "Delete selected keys ?", type: "error", showCancelButton: true - }, - function(){ - - var params = { - conn: "{{ $conn }}", - key: keys, - _token: LA.token - }; - - $.ajax({ - url: '{{ route('redis-key-delete') }}', - type: 'DELETE', - data: params, - success: function(result) { - toastr.success(params.key.length+' keys deleted'); - $.pjax.reload('#pjax-container'); - } - }); + }).then(function (result) { + if (result.value) { + + + var params = { + conn: "{{ $conn }}", + key: keys, + _token: LA.token + }; + + $.ajax({ + url: '{{ route('redis-key-delete') }}', + type: 'DELETE', + data: params, + success: function (result) { + toastr.success(params.key.length + ' keys deleted'); + $.pjax.reload('#pjax-container'); + } + }); + } }); });