From 9f6f36d7933481bb682de41b4655e05a2cd87d37 Mon Sep 17 00:00:00 2001 From: Quentin Guillemin Date: Wed, 5 Jun 2024 12:06:50 +0200 Subject: [PATCH] fix: delete file --- src/main/webapp/src/stores/fileStore.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/src/stores/fileStore.ts b/src/main/webapp/src/stores/fileStore.ts index f19c6bdf..484d510c 100644 --- a/src/main/webapp/src/stores/fileStore.ts +++ b/src/main/webapp/src/stores/fileStore.ts @@ -71,8 +71,9 @@ export const useFileStore = defineStore('file', () => { * Delete a file */ const deleteFile = (fileId: number): void => { - const index = files.value?.findIndex((file) => file.id === fileId); - if (index && index > -1) files.value?.splice(index, 1); + if (!files.value) return; + const index = files.value.findIndex((file) => file.id === fileId); + if (index > -1) files.value.splice(index, 1); }; /**