diff --git a/public/react/src/modules/courses/coursesPublic/SelectSetting.js b/public/react/src/modules/courses/coursesPublic/SelectSetting.js index 337b4d2e8..1e177be3d 100644 --- a/public/react/src/modules/courses/coursesPublic/SelectSetting.js +++ b/public/react/src/modules/courses/coursesPublic/SelectSetting.js @@ -108,10 +108,13 @@ class Selectsetting extends Component{ let {fileList,is_public,description,datatime,Radiovalue}=this.state; let newfileList=[]; - for(var list of fileList){ - newfileList.push(list.response.id) + if(fileList!=undefined&&fileList.length>0){ + for(var list of fileList){ + newfileList.push(list.response.id) + } } + if(this.state.Radiovalue===1){ if(datatime===undefined||datatime===null||datatime=== ""){ this.setState({ diff --git a/public/react/src/modules/courses/coursesPublic/sendResource.js b/public/react/src/modules/courses/coursesPublic/sendResource.js index 0f4e3cfbe..e423340e7 100644 --- a/public/react/src/modules/courses/coursesPublic/sendResource.js +++ b/public/react/src/modules/courses/coursesPublic/sendResource.js @@ -130,10 +130,14 @@ class Sendresource extends Component{ let {fileList,description,is_public,datatime,Radiovalue} =this.state; let newfileList=[]; - for(var list of fileList){ - newfileList.push(list.response.id) + + if(fileList!=undefined&&fileList.length>0){ + for(var list of fileList){ + newfileList.push(list.response.id) + } } + if(newfileList.length===0){ this.setState({ newfileListtype:true