fix: call functions properly

This commit is contained in:
ThatOneCalculator 2022-12-11 17:33:45 -08:00
parent 177eacbceb
commit 14b632a828
No known key found for this signature in database
GPG Key ID: 8703CACD01000000
1 changed files with 13 additions and 9 deletions

View File

@ -6,8 +6,10 @@
<template #prefix><i class="ph-airplane-takeoff-bold ph-lg"></i></template> <template #prefix><i class="ph-airplane-takeoff-bold ph-lg"></i></template>
<template #label>{{ i18n.ts.moveToLabel }}</template> <template #label>{{ i18n.ts.moveToLabel }}</template>
</FormInput> </FormInput>
<FormButton primary danger @click="move()">{{ i18n.ts.moveAccount }}</FormButton> <FormButton primary danger @click="move(moveToAccount)">
{{ i18n.ts.moveAccount }}
<template #caption>{{ i18n.ts.moveAccountDescription }}</template> <template #caption>{{ i18n.ts.moveAccountDescription }}</template>
</FormButton>
</FormSection> </FormSection>
<FormSection> <FormSection>
@ -16,8 +18,10 @@
<template #prefix><i class="ph-airplane-landing-bold ph-lg"></i></template> <template #prefix><i class="ph-airplane-landing-bold ph-lg"></i></template>
<template #label>{{ i18n.ts.moveFromLabel }}</template> <template #label>{{ i18n.ts.moveFromLabel }}</template>
</FormInput> </FormInput>
<FormButton class="button" inline primary @click="save(accountAlias)"><i class="ph-floppy-disk-back-bold ph-lg"></i> {{ i18n.ts.save }}</FormButton> <FormButton class="button" inline primary @click="save(accountAlias)">
<i class="ph-floppy-disk-back-bold ph-lg"></i> {{ i18n.ts.save }}
<template #caption>{{ i18n.ts.moveFromDescription }}</template> <template #caption>{{ i18n.ts.moveFromDescription }}</template>
</FormButton>
</FormSection> </FormSection>
</div> </div>
</template> </template>
@ -33,20 +37,20 @@ import { definePageMetadata } from '@/scripts/page-metadata';
let moveToAccount = $ref(''); let moveToAccount = $ref('');
let accountAlias = $ref(''); let accountAlias = $ref('');
async function save(): Promise<void> { async function save(account): Promise<void> {
os.apiWithDialog('i/known-as', { os.apiWithDialog('i/known-as', {
alsoKnownAs: accountAlias, alsoKnownAs: account,
}); });
} }
async function move(): Promise<void> { async function move(account): Promise<void> {
const confirm = await os.confirm({ const confirm = await os.confirm({
type: 'warning', type: 'warning',
text: i18n.t('migrationConfirm', { account: moveToAccount.toString() }), text: i18n.t('migrationConfirm', { account: account.toString() }),
}); });
if (confirm.canceled) return; if (confirm.canceled) return;
os.api('i/move', { os.api('i/move', {
moveToAccount: moveToAccount, moveToAccount: account,
}); });
} }