Skip to content

Commit

Permalink
fix: url for video uploads (#453)
Browse files Browse the repository at this point in the history
* fix: url for video uploads

* fix: possible undefined error in postUrlRedirect
  • Loading branch information
KristinAoki authored Jan 16, 2024
1 parent 4653322 commit 1bc4e51
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/editors/containers/VideoUploadEditor/VideoUploader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import messages from './messages';

const URLUploader = () => {
const [textInputValue, setTextInputValue] = React.useState('');
const onURLUpload = hooks.onVideoUpload();
const onURLUpload = hooks.onVideoUpload('selectedVideoUrl');
const intl = useIntl();
return (
<div className="d-flex flex-column">
Expand Down Expand Up @@ -67,7 +67,7 @@ export const VideoUploader = ({ setLoading }) => {
dispatch(thunkActions.video.uploadVideo({
supportedFiles: [fileData],
setLoadSpinner: setLoading,
postUploadRedirect: hooks.onVideoUpload(),
postUploadRedirect: hooks.onVideoUpload('selectedVideoId'),
}));
};

Expand Down
8 changes: 4 additions & 4 deletions src/editors/containers/VideoUploadEditor/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ export const {
navigateTo,
} = appHooks;

export const postUploadRedirect = (storeState) => {
export const postUploadRedirect = (storeState, uploadType = 'selectedVideoUrl') => {
const learningContextId = selectors.app.learningContextId(storeState);
const blockId = selectors.app.blockId(storeState);
return (videoUrl) => navigateTo(`/course/${learningContextId}/editor/video/${blockId}?selectedVideoUrl=${videoUrl}`);
return (videoUrl) => navigateTo(`/course/${learningContextId}/editor/video/${blockId}?${uploadType}=${videoUrl}`);
};

export const onVideoUpload = () => {
export const onVideoUpload = (uploadType) => {
const storeState = store.getState();
return module.postUploadRedirect(storeState);
return module.postUploadRedirect(storeState, uploadType);
};

export const useUploadVideo = async ({
Expand Down

0 comments on commit 1bc4e51

Please sign in to comment.