Skip to content

Commit cafb224

Browse files
Fixes some some
1 parent f4693a8 commit cafb224

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/app/upload/page.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,16 @@ const Page = () => {
3838
const [exam, setExam] = useState("");
3939
const [year, setYear] = useState("");
4040
const [files, setFiles] = useState<File[]>([]);
41+
const [inputValue, setInputValue] = useState('')
42+
4143
const [isSubjectCommandOpen, setIsSubjectCommandOpen] = useState(false);
4244
// const toggleOpenCamera = () => {
4345
// setOpenCamera((prev) => !prev);
4446
// };
4547

4648
const handlePrint = async () => {
4749
const maxFileSize = 5 * 1024 * 1024;
48-
const allowedFileTypes = ["application/pdf", "image/jpeg", "image/png", "image/gif"];
50+
// const allowedFileTypes = ["application/pdf", "image/jpeg", "image/png", "image/gif"];
4951
const files = fileInputRef.current?.files as FileList | null;
5052

5153
if (!files || files.length === 0) {
@@ -62,10 +64,10 @@ const Page = () => {
6264
return;
6365
}
6466

65-
if (!allowedFileTypes.includes(file.type)) {
66-
toast.error(`File type of ${file.name} is not allowed. Only PDFs and images are accepted.`);
67-
return;
68-
}
67+
// if (!allowedFileTypes.includes(file.type)) {
68+
// toast.error(`File type of ${file.name} is not allowed. Only PDFs and images are accepted.`);
69+
// return;
70+
// }
6971
}
7072

7173
const formData = new FormData();
@@ -92,7 +94,7 @@ const Page = () => {
9294
);
9395
return response.data;
9496
} catch (error) {
95-
handleAPIError(error);
97+
throw handleAPIError(error);
9698
}
9799
})(),
98100
{
@@ -193,7 +195,10 @@ const Page = () => {
193195
)}
194196
</div> */}
195197
<Command className="rounded-lg border shadow-md md:min-w-[450px]">
196-
<CommandInput placeholder="Type a subject or search..." />
198+
<CommandInput
199+
value={inputValue}
200+
onChangeCapture={(e) => setInputValue((e.target as HTMLInputElement).value)}
201+
placeholder="Type a subject or search..." />
197202
<CommandList className="h-[100px]">
198203
<CommandEmpty>No results found.</CommandEmpty>
199204

0 commit comments

Comments
 (0)