"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.logout = exports.default = void 0;
var _session = _interopRequireDefault(require("../helpers/session"));
var _prefs = require("./prefs");
var _actionCodes = require("../constants/actionCodes");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const logout = () => dispatch => {
  dispatch({
    type: _actionCodes.LOGOUT_STARTED
  });
  dispatch((0, _prefs.savePrefs)());
  return (0, _session.default)().logout().then(response => dispatch({
    type: _actionCodes.LOGOUT_FULFILLED,
    payload: response
  })).then(() => dispatch((0, _prefs.loadPrefs)()));
};
exports.logout = logout;
var _default = {};
exports.default = _default;