fix: validations

This commit is contained in:
DomWane 2024-10-01 13:59:25 +02:00
parent a3cb839f2d
commit ed9e80af29
3 changed files with 13 additions and 12 deletions

View file

@ -38,8 +38,8 @@ resetForm({
},
})
function isFormValid() {
validate()
async function isFormValid() {
await validate()
if (meta.value.valid) {
return true

View file

@ -108,7 +108,7 @@ async function next() {
return
if (selectedTab.value === 'basic_info') {
if (!currentComponent.value.isFormValid())
if (!(await currentComponent.value.isFormValid()))
return
else save()
}
@ -122,7 +122,7 @@ async function next() {
async function publish() {
if (selectedTab.value === 'basic_info') {
if (!currentComponent.value.isFormValid())
if (!(await currentComponent.value.isFormValid()))
return
else save()
}
@ -136,9 +136,9 @@ async function publish() {
navigateTo(`/project/${project.value?.id || project.value?.name?.toLowerCase().replace(/\s+/g, '-')}`)
}
function jumpTo(tab: string) {
async function jumpTo(tab: string) {
if (selectedTab.value === 'basic_info') {
if (!currentComponent.value.isFormValid())
if (!(await currentComponent.value.isFormValid()))
return
else save()
}

View file

@ -89,9 +89,9 @@ function save() {
})
}
function next() {
async function next() {
if (selectedTab.value === 'basic_info') {
if (!currentComponent.value.isFormValid())
if (!(await currentComponent.value.isFormValid()))
return
else save()
}
@ -105,7 +105,7 @@ function next() {
async function publish() {
if (selectedTab.value === 'basic_info') {
if (!currentComponent.value.isFormValid())
if (!(await currentComponent.value.isFormValid()))
return
else save()
}
@ -119,9 +119,10 @@ async function publish() {
navigateTo('/')
}
function jumpTo(tab: string) {
async function jumpTo(tab: string) {
console.log(tab, selectedTab.value)
if (selectedTab.value === 'basic_info') {
if (!currentComponent.value.isFormValid())
if (!(await currentComponent.value.isFormValid()))
return
else save()
}
@ -273,7 +274,7 @@ const transitionDone = ref(false)
pb-8px
leading-40px
:class="selectedTab === tab.value ? 'font-bold border-b-4 border-app-white' : ''"
@click="selectedTab = tab.value"
@click="jumpTo(tab.value)"
>
{{ tab.label }}
</button>