mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-01 21:31:36 +02:00
Fix up makeRequest, so it copes with analytics.url being un-configured.
This commit is contained in:
@@ -4,8 +4,10 @@ _ = require "underscore"
|
||||
request = require "request"
|
||||
|
||||
|
||||
makeRequest: (opts, callback)->
|
||||
makeRequest = (opts, callback)->
|
||||
if settings.apis?.analytics?.url?
|
||||
urlPath = opts.url
|
||||
opts.url = "#{settings.apis.analytics.url}#{urlPath}"
|
||||
request opts, callback
|
||||
else
|
||||
callback()
|
||||
@@ -25,7 +27,7 @@ module.exports =
|
||||
json:true
|
||||
method:"POST"
|
||||
timeout:1000
|
||||
url: "#{settings.apis.analytics.url}/user/#{user_id}/event"
|
||||
url: "/user/#{user_id}/event"
|
||||
makeRequest opts, callback
|
||||
|
||||
|
||||
@@ -36,11 +38,11 @@ module.exports =
|
||||
json:true
|
||||
method:"POST"
|
||||
timeout:1000
|
||||
url: "#{settings.apis.analytics.url}/user/#{user_id}/event/last_occurnace"
|
||||
url: "/user/#{user_id}/event/last_occurnace"
|
||||
makeRequest opts, (err, response, body)->
|
||||
if err?
|
||||
console.log response, opts
|
||||
logger.err {user_id, err}, "error getting last occurance of event"
|
||||
return callback err
|
||||
else
|
||||
return callback null, body
|
||||
return callback null, body
|
||||
|
||||
Reference in New Issue
Block a user