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.web.js 790B

12345678910111213141516171819202122232425262728293031323334
  1. // @flow
  2. import { toState } from '../base/redux';
  3. import { getServerURL } from '../base/settings';
  4. declare var interfaceConfig: Object;
  5. /**
  6. * Retrieves the default URL for the app. This can either come from a prop to
  7. * the root App component or be configured in the settings.
  8. *
  9. * @param {Function|Object} stateful - The redux store or {@code getState}
  10. * function.
  11. * @returns {string} - Default URL for the app.
  12. */
  13. export function getDefaultURL(stateful: Function | Object) {
  14. const state = toState(stateful);
  15. const { href } = window.location;
  16. if (href) {
  17. return href;
  18. }
  19. return getServerURL(state);
  20. }
  21. /**
  22. * Returns application name.
  23. *
  24. * @returns {string} The application name.
  25. */
  26. export function getName() {
  27. return interfaceConfig.APP_NAME;
  28. }