fix(types): allow File or ChangeEvent in handleFileUpload and ensure safe localStorage in userStore

This commit is contained in:
parsa aghaei committed 2026-08-03 10:16:57 +03:30
1 parent c1b2f416ed
commit 7e072793eb
4 files changed
+14 -54

No files matched your search

+7 -2
View File
@@ -83,8 +83,13 @@ export default function Videos() {
setIsModalOpen(true);
};
const handleFileUpload = async (e: React.ChangeEvent<HTMLInputElement>, type: 'thumbnail' | 'video') => {
const file = e.target.files?.[0];
const handleFileUpload = async (e: React.ChangeEvent<HTMLInputElement> | File, type: 'thumbnail' | 'video') => {
let file: File | undefined;
if (e instanceof File) {
file = e;
} else {
file = e.target.files?.[0];
}
if (!file) return;
const uploadData = new FormData();