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 803B

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