/*global __SERVER__ */
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.formatUrl = formatUrl;

var _config = require('../../server/config');

var _config2 = _interopRequireDefault(_config);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function formatUrl(path) {
  if (__SERVER__) {
    // Prepend host and port of the API server to the path.
    return _config2.default.apiProtocol + '://' + _config2.default.apiHost + ':' + _config2.default.apiPort + '/' + path;
  }
  // Prepend `/api` to relative URL, to proxy to API server.
  return '/api/' + path;
}