Browse Source

Add delay after saving `doctrines`

pull/129/head
alexdbondoc17 4 years ago
parent
commit
8acbcbdae7
  1. 6
      app/javascript/controllers/doctrines_controller.js

6
app/javascript/controllers/doctrines_controller.js

@ -95,14 +95,16 @@ export default class extends ApplicationController {
if (annotations_attributes.length > 0) { if (annotations_attributes.length > 0) {
$.each(annotations_attributes, function(index, annotation) { $.each(annotations_attributes, function(index, annotation) {
$.post("/api/doctrines/" + doctrine.id + "/annotations", annotation, function(annotation, status) { $.post("/api/doctrines/" + doctrine.id + "/annotations", annotation, function(result, status) {
if(status === 'success') { if(status === 'success') {
$('.toast').addClass('bg-success').show(); $('.toast').addClass('bg-success').show();
$( ".toast-body" ).html( "<span><b>Case Lists was successfully save</b></span>" ); $( ".toast-body" ).html( "<span><b>Case Lists was successfully save</b></span>" );
$('.toast').fadeOut(5000); $('.toast').fadeOut(5000);
if (index === annotations_attributes.length - 1) { if (index === annotations_attributes.length - 1) {
location.pathname = "/documents/" + document_id + "/doctrines/" + doctrine.id $(window).delay(5000).queue(function() {
location.pathname = "/documents/" + document_id + "/doctrines/" + doctrine.id
})
} }
} }
}) })

Loading…
Cancel
Save