From 6d6199a7086d785f2aee22154e939a06fe94e686 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 19 Aug 2019 11:05:44 +0800 Subject: [PATCH] remove --- .../react/src/modules/user/usersInfo/video/InfosVideo.js | 2 +- .../react/src/modules/user/usersInfo/video/VideoReducer.js | 4 ++++ .../src/modules/user/usersInfo/video/VideoUploadList.js | 7 ++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/user/usersInfo/video/InfosVideo.js b/public/react/src/modules/user/usersInfo/video/InfosVideo.js index 1ccf7e1b2..2f251b583 100644 --- a/public/react/src/modules/user/usersInfo/video/InfosVideo.js +++ b/public/react/src/modules/user/usersInfo/video/InfosVideo.js @@ -104,7 +104,7 @@ function InfoVideo (props) { setLoading(true) axios.get(fetchUrl, { params: { - per_page: 200 + per_page: 100 } }) .then((response) => { diff --git a/public/react/src/modules/user/usersInfo/video/VideoReducer.js b/public/react/src/modules/user/usersInfo/video/VideoReducer.js index 23d13273a..96faada0f 100644 --- a/public/react/src/modules/user/usersInfo/video/VideoReducer.js +++ b/public/react/src/modules/user/usersInfo/video/VideoReducer.js @@ -31,6 +31,10 @@ export function reducer(state, action) { return { videos: update(state.videos, {$splice: [[action.index, 1]]}) } + case 'removeAll': + return { + videos: [] + } case 'updateProgress': let _index = find(state, action) let newvideos = state.videos diff --git a/public/react/src/modules/user/usersInfo/video/VideoUploadList.js b/public/react/src/modules/user/usersInfo/video/VideoUploadList.js index dd5d6ccd4..f137a45d9 100644 --- a/public/react/src/modules/user/usersInfo/video/VideoUploadList.js +++ b/public/react/src/modules/user/usersInfo/video/VideoUploadList.js @@ -17,13 +17,16 @@ const files = [] const MAX_FILE_COUNT = 3 const MAX_FILE_SIZE = 200 let noUploads = true + function VideoUploadList (props) { // const [videos, setvideos] = useState([]); const [state, dispatch] = useReducer(reducer, initialState); const theme = useContext(ThemeContext) + const [couldRouteNav, setCouldRouteNav] = useState(false) useEffect(() => { + setCouldRouteNav(false); // Chrome removed support for custom message in ver 51 // https://stackoverflow.com/questions/38879742/is-it-possible-to-display-a-custom-message-in-the-beforeunload-popup window.addEventListener("beforeunload", beforeunload); @@ -220,6 +223,8 @@ function VideoUploadList (props) { }).then((response) => { // to success page if (response.data.status == 0) { + dispatch({type: 'removeAll'}) + // setCouldRouteNav(true) history.push(`/users/${username}/videos/success`) } }).catch((error) => { @@ -234,7 +239,7 @@ function VideoUploadList (props) { return (