Browse Source

wait for localforage callback before redirecting

should help clear out the draft when a post is created.

for #109
pull/110/head
Aaron Parecki 2 years ago
parent
commit
f8b122256f
No known key found for this signature in database GPG Key ID: 276C2817346D6056
1 changed files with 11 additions and 10 deletions
  1. +11
    -10
      views/new-post.php

+ 11
- 10
views/new-post.php View File

@ -815,16 +815,17 @@ $(function(){
if(typeof response == "string") {
response = JSON.parse(response);
}
localforage.removeItem('current-note');
if(response.location) {
window.location = response.location;
// console.log(response.location);
} else {
$("#test_response").html(response.response);
$("#test_response_container").removeClass('hidden');
$("#test_success").addClass('hidden');
$("#test_error").removeClass('hidden');
}
localforage.removeItem('current-note', function(){
if(response.location) {
window.location = response.location;
// console.log(response.location);
} else {
$("#test_response").html(response.response);
$("#test_response_container").removeClass('hidden');
$("#test_success").addClass('hidden');
$("#test_error").removeClass('hidden');
}
});
} catch(e) {
$("#test_success").addClass('hidden');
$("#test_error").removeClass('hidden');

Loading…
Cancel
Save