From 1bc4e51c22006db07971f9ef92a382f5470f52dc Mon Sep 17 00:00:00 2001
From: Kristin Aoki <42981026+KristinAoki@users.noreply.github.com>
Date: Tue, 16 Jan 2024 11:00:43 -0500
Subject: [PATCH] fix: url for video uploads (#453)
* fix: url for video uploads
* fix: possible undefined error in postUrlRedirect
---
.../containers/VideoUploadEditor/VideoUploader.jsx | 4 ++--
src/editors/containers/VideoUploadEditor/hooks.js | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/editors/containers/VideoUploadEditor/VideoUploader.jsx b/src/editors/containers/VideoUploadEditor/VideoUploader.jsx
index 8b7a73f94..9ef4d6ef4 100644
--- a/src/editors/containers/VideoUploadEditor/VideoUploader.jsx
+++ b/src/editors/containers/VideoUploadEditor/VideoUploader.jsx
@@ -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 (
@@ -67,7 +67,7 @@ export const VideoUploader = ({ setLoading }) => {
dispatch(thunkActions.video.uploadVideo({
supportedFiles: [fileData],
setLoadSpinner: setLoading,
- postUploadRedirect: hooks.onVideoUpload(),
+ postUploadRedirect: hooks.onVideoUpload('selectedVideoId'),
}));
};
diff --git a/src/editors/containers/VideoUploadEditor/hooks.js b/src/editors/containers/VideoUploadEditor/hooks.js
index d96996d81..e0f3f3847 100644
--- a/src/editors/containers/VideoUploadEditor/hooks.js
+++ b/src/editors/containers/VideoUploadEditor/hooks.js
@@ -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 ({