fix(settings): don't submit when clicking icon buttons

zio/stable
三咲智子 2023-01-03 18:13:48 +08:00
parent 245a37db19
commit 4ea5d8ba60
No known key found for this signature in database
GPG Key ID: 69992F2250DFD93E
2 changed files with 6 additions and 3 deletions

View File

@ -25,7 +25,7 @@ const chooseIcon = (i: number, text: string) => {
<div v-for="i in 4" :key="i" flex="~ gap3" items-center>
<CommonDropdown ref="dropdown" placement="left">
<CommonTooltip content="Pick a icon">
<button btn-action-icon>
<button type="button" btn-action-icon>
<div :class="fieldIcons[i - 1] || 'i-ri:question-mark'" />
</button>
</CommonTooltip>
@ -37,9 +37,9 @@ const chooseIcon = (i: number, text: string) => {
:content="text"
>
<template v-if="text !== 'Joined'">
<div btn-action-icon @click="chooseIcon(i - 1, text)">
<button type="button" btn-action-icon @click="chooseIcon(i - 1, text)">
<div text-xl :class="icon" />
</div>
</button>
</template>
</CommonTooltip>
</div>

View File

@ -54,6 +54,9 @@ onMastoInit(async () => {
const isCanSubmit = computed(() => !isError.value && !isEmptyObject(dirtyFields.value))
const { submit, submitting } = submitter(async ({ dirtyFields }) => {
if (!isCanSubmit.value)
return
const res = await useMasto().accounts.updateCredentials(dirtyFields.value as UpdateCredentialsParams)
.then(account => ({ account }))
.catch((error: Error) => ({ error }))