Merge pull request #24 from scub-france/bug-doc-upload

Fix evetn listening redirection on doc upload
This commit is contained in:
Pier-Jean Malandrino 2026-03-24 08:47:55 +01:00 committed by GitHub
commit c3e96b62cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 13 additions and 3 deletions

View file

@ -27,6 +27,8 @@ import { ref } from 'vue'
import { useDocumentStore } from '../store'
import { useI18n } from '../../../shared/i18n'
const emit = defineEmits<{ uploaded: [docId: string] }>()
const store = useDocumentStore()
const { t } = useI18n()
const fileInput = ref<HTMLInputElement | null>(null)
@ -39,7 +41,10 @@ function openFilePicker() {
async function onFileSelect(e: Event) {
const target = e.target as HTMLInputElement
const file = target.files?.[0]
if (file) await store.upload(file)
if (file) {
const doc = await store.upload(file)
if (doc) emit('uploaded', doc.id)
}
target.value = ''
}
@ -47,7 +52,8 @@ async function onDrop(e: DragEvent) {
dragging.value = false
const file = e.dataTransfer?.files?.[0]
if (file && file.type === 'application/pdf') {
await store.upload(file)
const doc = await store.upload(file)
if (doc) emit('uploaded', doc.id)
}
}
</script>

View file

@ -11,7 +11,7 @@
<!-- Quick upload -->
<div class="home-upload">
<DocumentUpload />
<DocumentUpload @uploaded="onUploaded" />
</div>
<!-- Stats -->
@ -71,6 +71,10 @@ const docCount = computed(() => documentStore.documents.length)
const analysisCount = computed(() => historyStore.analyses.length)
const recentDocs = computed(() => documentStore.documents.slice(0, 5))
function onUploaded() {
router.push('/studio')
}
function openInStudio(doc: Document) {
documentStore.select(doc.id)
router.push('/studio')