diff --git a/js/paper.js b/js/paper.js index 2fdc3f4..8c57d27 100644 --- a/js/paper.js +++ b/js/paper.js @@ -92,7 +92,7 @@ function createPaper(token, text) { }; var reqObj = {import_format: "html"}; - xhr.send(reqObj); + xhr.send("Paper-extension"); } function saveToPaper(token, paperId, text) { @@ -101,16 +101,16 @@ function saveToPaper(token, paperId, text) { var xhr = new XMLHttpRequest(); xhr.open("POST", url, true); var rev = result.Revision; - + xhr.setRequestHeader("Authorization", "Bearer " + token); xhr.setRequestHeader("Dropbox-API-Arg", "{\"doc_id\": \"" + paperId + "\",\"doc_update_policy\": \"prepend\",\"revision\": " + rev + ",\"import_format\": \"markdown\"}"); xhr.setRequestHeader("Content-Type", "application/octet-stream"); - + xhr.onreadystatechange = function() { if(xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) { new_rev = JSON.parse(this.response); chrome.storage.sync.set({Revision : new_rev.revision}); - } + } } xhr.send(text); });