Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

actions.js 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // @flow
  2. import { UPDATE_DROPBOX_TOKEN } from './actionTypes';
  3. import { _authorizeDropbox } from './functions';
  4. /**
  5. * Action to authorize the Jitsi Recording app in dropbox.
  6. *
  7. * @returns {Function}
  8. */
  9. export function authorizeDropbox() {
  10. return (dispatch: Function, getState: Function) => {
  11. const state = getState();
  12. const { locationURL } = state['features/base/connection'];
  13. const { dropbox = {} } = state['features/base/config'];
  14. // By default we use the static page on the main domain for redirection.
  15. // So we need to setup only one redirect URI in dropbox app
  16. // configuration (not multiple for all the tenants).
  17. // In case deployment is running in subfolder dropbox.redirectURI
  18. // can be configured.
  19. const redirectURI
  20. = dropbox.redirectURI || `${locationURL.origin}/static/oauth.html`;
  21. _authorizeDropbox(dropbox.appKey, redirectURI)
  22. .then(
  23. token => dispatch(updateDropboxToken(token)));
  24. };
  25. }
  26. /**
  27. * Action to update the dropbox access token.
  28. *
  29. * @param {string} token - The new token.
  30. * @returns {{
  31. * type: UPDATE_DROPBOX_TOKEN,
  32. * token: string
  33. * }}
  34. */
  35. export function updateDropboxToken(token: string) {
  36. return {
  37. type: UPDATE_DROPBOX_TOKEN,
  38. token
  39. };
  40. }