overleaf/services/web/app/coffee/Features/Docstore/DocstoreManager.coffee
James Allen 9be4feaae1 Revert "Get doc lines from docstore when performing batch operations"
This reverts commit 9fab27158cb02b0268f8e6aec090f275f062d885.
2014-05-01 17:19:21 +01:00

16 lines
No EOL
715 B
CoffeeScript

request = require("request").defaults(jar: false)
logger = require "logger-sharelatex"
settings = require "settings-sharelatex"
module.exports = DocstoreManager =
deleteDoc: (project_id, doc_id, callback = (error) ->) ->
logger.log project_id: project_id, "deleting doc in docstore api"
url = "#{settings.apis.docstore.url}/project/#{project_id}/doc/#{doc_id}"
request.del url, (error, res, body) ->
return callback(error) if error?
if 200 <= res.statusCode < 300
callback(null)
else
error = new Error("docstore api responded with non-success code: #{res.statusCode}")
logger.error err: error, project_id: project_id, doc_id: doc_id, "error deleting doc in docstore"
callback(error)