From 15b3c735a6b2d6eb258e717a6f12b532b0f283d8 Mon Sep 17 00:00:00 2001 From: hrshvrdhn03 Date: Thu, 21 Jun 2018 23:20:30 +0530 Subject: [PATCH] Issue#20: Add a static title to the paper doc created --- js/paper.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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); });