Ts changes weren't staged, it compiles still doesnt build building

This commit is contained in:
Carlos-Mesquita
2024-11-06 19:49:02 +00:00
parent a371b171bb
commit 7045b4e3c7
13 changed files with 45 additions and 29 deletions

View File

@@ -10,7 +10,7 @@ import { ReadingPart } from '@/interfaces/exam';
import { defaultSectionSettings } from '@/stores/examEditor/defaults';
const WordUploader: React.FC<{ module: Module }> = ({ module }) => {
const {currentModule, dispatch} = useExamEditorStore();
const { currentModule, dispatch } = useExamEditorStore();
const examInputRef = useRef<HTMLInputElement>(null);
const solutionsInputRef = useRef<HTMLInputElement>(null);
@@ -38,14 +38,14 @@ const WordUploader: React.FC<{ module: Module }> = ({ module }) => {
}
};
const handleImport = useCallback( async () => {
const handleImport = useCallback(async () => {
try {
if (!examFile) {
toast.error('Exam file is required');
return;
}
dispatch({type: "UPDATE_MODULE", payload: {updates: {importing: true}, module}})
dispatch({ type: "UPDATE_MODULE", payload: { updates: { importing: true }, module } })
const formData = new FormData();
formData.append('exercises', examFile);
@@ -76,27 +76,30 @@ const WordUploader: React.FC<{ module: Module }> = ({ module }) => {
const newSectionsStates = data.parts.map(
(part: ReadingPart, index: number) => defaultSectionSettings(module, index + 1, part)
);
dispatch({type: "UPDATE_MODULE", payload: {
updates: {
sections: newSectionsStates,
minTimer: data.minTimer,
importModule: false,
importing: false,
},
module
}});
dispatch({
type: "UPDATE_MODULE", payload: {
updates: {
sections: newSectionsStates,
minTimer: data.minTimer,
importModule: false,
importing: false,
},
module
}
});
break;
}
} catch (error) {
toast.error(`An unknown error has occured while import ${module} exam!`);
} finally {
dispatch({type: "UPDATE_MODULE", payload: {updates: {importing: false}, module}})
dispatch({ type: "UPDATE_MODULE", payload: { updates: { importing: false }, module } })
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
examFile,
solutionsFile,
dispatch,
module
currentModule
]);
return (