File tree Expand file tree Collapse file tree
app/dashboard/(timetable)/edit
components/shared_timetable Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ export default function EditTable() {
5757 } , [ popupDecision ] ) ;
5858
5959 const handleSaveTimetable = ( ) => {
60+ const nullLessTableData = removeNull ( tableData )
6061 addNotification ( 'Request sent. Please wait.' ) ;
6162 const header = {
6263 Authorization :
@@ -65,7 +66,7 @@ export default function EditTable() {
6566 axios
6667 . patch (
6768 API_BASE_URL + '/collection' ,
68- { courses_data : tableData } ,
69+ { courses_data : nullLessTableData } ,
6970 { headers : header }
7071 )
7172 . then ( ( response ) => {
@@ -316,3 +317,15 @@ function getOptions({ timetable }) {
316317 }
317318 return options ;
318319}
320+
321+ function removeNull ( tableData ) {
322+ var nullLessTableData = tableData ;
323+ for ( let i = 0 ; i < tableData . length ; i ++ ) {
324+ for ( let j = 0 ; j < 5 ; j ++ ) {
325+ if ( nullLessTableData [ i ] [ j ] == null ) {
326+ nullLessTableData [ i ] [ j ] = '' ;
327+ }
328+ }
329+ }
330+ return nullLessTableData ;
331+ }
Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ export default async function LoadTimetable({
1010 Authorization :
1111 'Token ' + JSON . parse ( localStorage . getItem ( ACCESS_TOKEN_NAME ) ) ,
1212 } ;
13+ if ( selectedOption == undefined ) {
14+ addNotification ( 'Choose an option' ) ;
15+ return ;
16+ }
1317 const payload = { copy_id : selectedOption . id } ;
1418 try {
1519 addNotification ( 'Loading Timetable...' ) ;
You can’t perform that action at this time.
0 commit comments