You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

functions.js 805B

12345678910111213141516171819202122232425262728
  1. /* @flow */
  2. /**
  3. * Returns current domain.
  4. *
  5. * @param {(Function|Object)} stateOrGetState - Redux getState() method or Redux
  6. * state.
  7. * @returns {(string|undefined)}
  8. */
  9. export function getDomain(stateOrGetState: Function | Object) {
  10. const state
  11. = typeof stateOrGetState === 'function'
  12. ? stateOrGetState()
  13. : stateOrGetState;
  14. const { options } = state['features/base/connection'];
  15. let domain;
  16. try {
  17. domain = options.hosts.domain;
  18. } catch (e) {
  19. // XXX The value of options or any of the properties descending from it
  20. // may be undefined at some point in the execution (e.g. on start).
  21. // Instead of multiple checks for the undefined value, we just wrap it
  22. // in a try-catch block.
  23. }
  24. return domain;
  25. }