1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-11-02 23:19:57 +00:00

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

View file

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