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

This commit is contained in:
三咲智子 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 }))