'use strict';

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

var _constants = require('./constants');

var _accessToken = require('./accessToken');

function authorize() {
  window.top.location = '' + _constants.AUTH_URL;
}

function logout() {
  var token = (0, _accessToken.getCookieToken)();
  var logoutUrl = _constants.AUTH_HOST + '/logout';
  if (token) {
    logoutUrl += '?' + _constants.ACCESS_TOKEN + '=' + (0, _accessToken.getCookieToken)();
  }
  (0, _accessToken.removeAccessToken)();
  localStorage.clear();
  sessionStorage.clear();
  window.location = logoutUrl;
}