Skip to content

Commit 61ee864

Browse files
fix: verify that reuse type exists beofre enabling suggestion button
1 parent a9c2b49 commit 61ee864

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

components/Reuses/DescribeReuse.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,9 @@ const accordionState = (key: keyof typeof form.value) => {
473473
const canGenerateTags = computed(() => {
474474
const hasTitle = form.value.title && form.value.title.trim().length > 0
475475
const hasDescription = form.value.description && form.value.description.trim().length > 0
476+
const hasType = form.value.type?.label && form.value.type.label.trim().length > 0
476477
const hasLessThanMaxTags = form.value.tags.length < MAX_TAGS_NB
477-
return hasTitle && hasDescription && hasLessThanMaxTags
478+
return hasTitle && hasDescription && hasType && hasLessThanMaxTags
478479
})
479480
480481
const setFiles = (files: Array<File>) => {
@@ -493,6 +494,10 @@ async function submit() {
493494
}
494495
495496
async function handleAutoCompleteTags(nbTags: number) {
497+
if (!form.value.type?.label) {
498+
return
499+
}
500+
496501
try {
497502
isGeneratingTags.value = true
498503
@@ -504,7 +509,7 @@ async function handleAutoCompleteTags(nbTags: number) {
504509
body: {
505510
title: form.value.title,
506511
description: form.value.description,
507-
type: form.value.type?.label,
512+
type: form.value.type.label.toLowerCase(),
508513
nbTags: nbTags,
509514
},
510515
})

0 commit comments

Comments
 (0)