Skip to content

Commit

Permalink
fixing bug when uploading and deleting files in model creation
Browse files Browse the repository at this point in the history
  • Loading branch information
mauriciomb97 committed Oct 24, 2024
1 parent e0f694e commit 0bdad59
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions components/TrainForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
:showUploadButton="false"
:showCancelButton="false"
@select="onFileSelected"
@removeUploadedFile="onFileRemoved"
/>
</div>

Expand Down Expand Up @@ -80,7 +81,7 @@
</template>

<script setup lang="ts">
import type { FileUploadSelectEvent } from "primevue/fileupload";
import type { FileUploadSelectEvent, FileUploadRemoveEvent } from "primevue/fileupload";
import { computed, ref } from "vue";
const { data: session } = useAuth();
Expand Down Expand Up @@ -127,7 +128,11 @@ const emits = defineEmits<(e: "submit", data: TrainFormValues) => void>();
const files = ref<File[]>([]);
const onFileSelected = (event: FileUploadSelectEvent) => {
files.value = [...event.files];
files.value = [...files.value, ...event.files];
};
const onFileRemoved = (event: FileUploadRemoveEvent) => {
files.value = files.value.filter(file => file.name !== event.file.name);
};
const modelName = ref<string>('');
Expand Down

0 comments on commit 0bdad59

Please sign in to comment.