From 5cbfca3733314b0cdfd652ff0b035027d61e7c32 Mon Sep 17 00:00:00 2001 From: Matthew Morley Date: Mon, 9 Oct 2023 10:10:39 -0400 Subject: [PATCH] Fix function argument types for file upload Co-Authored-By: Sriman Achanta <68172138+srimanachanta@users.noreply.github.com> --- .../src/components/cameras/CameraCalibrationCard.vue | 5 ++++- photon-client/src/components/settings/DeviceControlCard.vue | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/photon-client/src/components/cameras/CameraCalibrationCard.vue b/photon-client/src/components/cameras/CameraCalibrationCard.vue index a5b3be4c4f..17700db2d4 100644 --- a/photon-client/src/components/cameras/CameraCalibrationCard.vue +++ b/photon-client/src/components/cameras/CameraCalibrationCard.vue @@ -150,7 +150,10 @@ const importCalibrationFromCalibDB = ref(); const openCalibUploadPrompt = () => { importCalibrationFromCalibDB.value.click(); }; -const readImportedCalibration = ({ files }: { files: FileList }) => { +const readImportedCalibration = (payload: Event) => { + if (payload.target == null || !payload.target?.files) return; + const files: FileList = payload.target.files as FileList; + files[0].text().then((text) => { useCameraSettingsStore() .importCalibDB({ payload: text, filename: files[0].name }) diff --git a/photon-client/src/components/settings/DeviceControlCard.vue b/photon-client/src/components/settings/DeviceControlCard.vue index fccbf58cc1..29ae2e92d0 100644 --- a/photon-client/src/components/settings/DeviceControlCard.vue +++ b/photon-client/src/components/settings/DeviceControlCard.vue @@ -63,7 +63,7 @@ const offlineUpdate = ref(); const openOfflineUpdatePrompt = () => { offlineUpdate.value.click(); }; -const handleOfflineUpdate = ({ files }: { files: FileList }) => { +const handleOfflineUpdate = (payload: Event) => { useStateStore().showSnackbarMessage({ message: "New Software Upload in Progress...", color: "secondary", @@ -71,6 +71,9 @@ const handleOfflineUpdate = ({ files }: { files: FileList }) => { }); const formData = new FormData(); + + if (payload.target == null || !payload.target?.files) return; + const files: FileList = payload.target.files as FileList; formData.append("jarData", files[0]); axios