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.js 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // @flow
  2. import { getLocationContextRoot } from '../base/util';
  3. import { UPDATE_DROPBOX_TOKEN } from './actionTypes';
  4. import { _authorizeDropbox } from './functions';
  5. /**
  6. * Action to authorize the Jitsi Recording app in dropbox.
  7. *
  8. * @returns {Function}
  9. */
  10. export function authorizeDropbox() {
  11. return (dispatch: Function, getState: Function) => {
  12. const state = getState();
  13. const { locationURL } = state['features/base/connection'];
  14. const { dropbox = {} } = state['features/base/config'];
  15. const redirectURI = `${locationURL.origin
  16. + getLocationContextRoot(locationURL)}static/oauth.html`;
  17. _authorizeDropbox(dropbox.appKey, redirectURI)
  18. .then(
  19. token => dispatch(updateDropboxToken(token)));
  20. };
  21. }
  22. /**
  23. * Action to update the dropbox access token.
  24. *
  25. * @param {string} token - The new token.
  26. * @returns {{
  27. * type: UPDATE_DROPBOX_TOKEN,
  28. * token: string
  29. * }}
  30. */
  31. export function updateDropboxToken(token: string) {
  32. return {
  33. type: UPDATE_DROPBOX_TOKEN,
  34. token
  35. };
  36. }