mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
00a489a000
Test brand variation details. Rename BrandVariationsController to BrandVariationsHandler. Use the V1 API helper. Do not swallow errors when fetching brand details for project load. Fix indentation.
16 lines
738 B
CoffeeScript
16 lines
738 B
CoffeeScript
settings = require "settings-sharelatex"
|
|
logger = require "logger-sharelatex"
|
|
V1Api = require "../V1/V1Api"
|
|
|
|
module.exports = BrandVariationsHandler =
|
|
getBrandVariationById: (brandVariationId, callback = (error, brandVariationDetails) ->)->
|
|
if !brandVariationId? or brandVariationId == ""
|
|
return callback(new Error("Branding variation id not provided"))
|
|
logger.log brandVariationId: brandVariationId, "fetching brand variation details from v1"
|
|
V1Api.request {
|
|
uri: "/api/v2/brand_variations/#{brandVariationId}"
|
|
}, (error, response, brandVariationDetails) ->
|
|
if error?
|
|
logger.err { brandVariationId, error}, "error getting brand variation details"
|
|
return callback(error)
|
|
callback(null, brandVariationDetails)
|