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.

actions.web.ts 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import { maybeRedirectToWelcomePage } from '../app/actions.web';
  2. import { IStore } from '../app/types';
  3. import {
  4. CANCEL_LOGIN,
  5. LOGIN,
  6. LOGOUT
  7. } from './actionTypes';
  8. export * from './actions.any';
  9. /**
  10. * Cancels {@ink LoginDialog}.
  11. *
  12. * @returns {{
  13. * type: CANCEL_LOGIN
  14. * }}
  15. */
  16. export function cancelLogin() {
  17. return {
  18. type: CANCEL_LOGIN
  19. };
  20. }
  21. /**
  22. * Cancels authentication, closes {@link WaitForOwnerDialog}
  23. * and navigates back to the welcome page only in the case of authentication required error.
  24. * We can be showing the dialog while lobby is enabled and participant is still waiting there and hiding this dialog
  25. * should do nothing.
  26. *
  27. * @returns {Function}
  28. */
  29. export function cancelWaitForOwner() {
  30. return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
  31. const { authRequired } = getState()['features/base/conference'];
  32. authRequired && dispatch(maybeRedirectToWelcomePage());
  33. };
  34. }
  35. /** .
  36. * Redirect to the default location (e.g. Welcome page).
  37. *
  38. * @returns {Function}
  39. */
  40. export function redirectToDefaultLocation() {
  41. return (dispatch: IStore['dispatch']) => dispatch(maybeRedirectToWelcomePage());
  42. }
  43. /**
  44. * Login.
  45. *
  46. * @returns {{
  47. * type: LOGIN
  48. * }}
  49. */
  50. export function login() {
  51. return {
  52. type: LOGIN
  53. };
  54. }
  55. /**
  56. * Logout.
  57. *
  58. * @returns {{
  59. * type: LOGOUT
  60. * }}
  61. */
  62. export function logout() {
  63. return {
  64. type: LOGOUT
  65. };
  66. }