'use strict';

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

var _modal = require('choerodon-hap-ui/lib/modal');

var _modal2 = _interopRequireDefault(_modal);

require('choerodon-hap-ui/lib/modal/style');

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _authorize = require('./authorize');

var _axios = require('../components/axios');

var _axios2 = _interopRequireDefault(_axios);

var _AppState = require('../stores/AppState');

var _AppState2 = _interopRequireDefault(_AppState);

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

var modalKey = _modal2['default'].key();

function repeatLigin() {
  _modal2['default'].open({
    key: modalKey,
    title: '提示',
    children: '异地登录，请重新登录',
    okCancel: false,
    onOk: function onOk() {
      if (_AppState2['default'].isCas) {
        (0, _authorize.logout)();
      } else {
        _axios2['default'].post('/logout').then(function () {
          (0, _authorize.authorize)();
        });
      }
    }
  });
}

exports['default'] = repeatLigin;