Skip to content
Snippets Groups Projects
Commit fbc933d0 authored by TobiasReiter's avatar TobiasReiter
Browse files

POST oly .docx files

parent 149539c3
No related branches found
No related tags found
3 merge requests!54feat: details modal fixes #51,!53feat: added original TÜ logo, fixed padding error #49,!52feat: checking file before posting #48
...@@ -9,7 +9,6 @@ import CloseIcon from "@/app/components/assets/CloseIcon"; ...@@ -9,7 +9,6 @@ import CloseIcon from "@/app/components/assets/CloseIcon";
import data from "../../data/en.json"; import data from "../../data/en.json";
const InfoModal = ({ show, onClose, details }) => { const InfoModal = ({ show, onClose, details }) => {
const questionTypes = useMemo(() => { const questionTypes = useMemo(() => {
if ( if (
!details?.questionConfigDetails || !details?.questionConfigDetails ||
...@@ -32,7 +31,7 @@ const InfoModal = ({ show, onClose, details }) => { ...@@ -32,7 +31,7 @@ const InfoModal = ({ show, onClose, details }) => {
)} )}
/> />
); );
}, [details.questionConfigDetails]); }, [details?.questionConfigDetails]);
const questionErrors = useMemo(() => { const questionErrors = useMemo(() => {
if ( if (
...@@ -57,7 +56,7 @@ const InfoModal = ({ show, onClose, details }) => { ...@@ -57,7 +56,7 @@ const InfoModal = ({ show, onClose, details }) => {
)} )}
/> />
); );
}, [details.questionErrors]); }, [details?.questionErrors]);
const questionWarnings = useMemo(() => { const questionWarnings = useMemo(() => {
if ( if (
...@@ -82,7 +81,7 @@ const InfoModal = ({ show, onClose, details }) => { ...@@ -82,7 +81,7 @@ const InfoModal = ({ show, onClose, details }) => {
)} )}
/> />
); );
}, [details.questionWarnings]); }, [details?.questionWarnings]);
return ( return (
<Modal show={show} onClose={onClose}> <Modal show={show} onClose={onClose}>
......
import { toast } from "react-toastify";
import data from "../../data/en.json";
export const sendFileToBackend = async (file, outputFormat) => { export const sendFileToBackend = async (file, outputFormat) => {
const fileName = file[0]?.name.toLowerCase();
if (!fileName?.endsWith(".docx")) {
toast.error(data.fileupload.fileNotAcceptable, {
position: "bottom-right",
hideProgressBar: true,
});
throw new Error(data.fileupload.fileNotAcceptable);
}
const formData = new FormData(); const formData = new FormData();
formData.append("file", file[0]); formData.append("file", file[0]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment