2022-12-10 07:28:50 +09:00
|
|
|
<template>
|
|
|
|
<div class="_formRoot">
|
|
|
|
<FormSection>
|
|
|
|
<template #label>{{ i18n.ts.moveTo }}</template>
|
2022-12-12 09:42:40 +09:00
|
|
|
<FormInput v-model="moveToAccount" class="_formBlock">
|
2022-12-10 07:28:50 +09:00
|
|
|
<template #prefix><i class="ph-airplane-takeoff-bold ph-lg"></i></template>
|
|
|
|
<template #label>{{ i18n.ts.moveToLabel }}</template>
|
|
|
|
</FormInput>
|
2022-12-12 10:33:45 +09:00
|
|
|
<FormButton primary danger @click="move(moveToAccount)">
|
|
|
|
{{ i18n.ts.moveAccount }}
|
|
|
|
</FormButton>
|
2022-12-12 10:40:10 +09:00
|
|
|
<div class="label">{{ i18n.ts.moveAccountDescription }}</div>
|
2022-12-10 07:28:50 +09:00
|
|
|
</FormSection>
|
|
|
|
|
|
|
|
<FormSection>
|
|
|
|
<template #label>{{ i18n.ts.moveFrom }}</template>
|
|
|
|
<FormInput v-model="accountAlias" class="_formBlock">
|
|
|
|
<template #prefix><i class="ph-airplane-landing-bold ph-lg"></i></template>
|
|
|
|
<template #label>{{ i18n.ts.moveFromLabel }}</template>
|
|
|
|
</FormInput>
|
2022-12-12 10:33:45 +09:00
|
|
|
<FormButton class="button" inline primary @click="save(accountAlias)">
|
|
|
|
<i class="ph-floppy-disk-back-bold ph-lg"></i> {{ i18n.ts.save }}
|
|
|
|
</FormButton>
|
2022-12-12 10:40:10 +09:00
|
|
|
<div class="label">{{ i18n.ts.moveFromDescription }}</div>
|
2022-12-10 07:28:50 +09:00
|
|
|
</FormSection>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import FormSection from '@/components/form/section.vue';
|
|
|
|
import FormInput from '@/components/form/input.vue';
|
|
|
|
import FormButton from '@/components/MkButton.vue';
|
|
|
|
import * as os from '@/os';
|
|
|
|
import { i18n } from '@/i18n';
|
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
|
|
|
|
2022-12-12 09:42:40 +09:00
|
|
|
let moveToAccount = $ref('');
|
2022-12-10 07:28:50 +09:00
|
|
|
let accountAlias = $ref('');
|
|
|
|
|
2022-12-12 10:33:45 +09:00
|
|
|
async function save(account): Promise<void> {
|
2022-12-12 09:42:40 +09:00
|
|
|
os.apiWithDialog('i/known-as', {
|
2022-12-12 10:33:45 +09:00
|
|
|
alsoKnownAs: account,
|
2022-12-12 09:42:40 +09:00
|
|
|
});
|
2022-12-10 07:28:50 +09:00
|
|
|
}
|
|
|
|
|
2022-12-12 10:33:45 +09:00
|
|
|
async function move(account): Promise<void> {
|
2022-12-12 10:28:11 +09:00
|
|
|
const confirm = await os.confirm({
|
|
|
|
type: 'warning',
|
2022-12-12 10:33:45 +09:00
|
|
|
text: i18n.t('migrationConfirm', { account: account.toString() }),
|
2022-12-12 10:28:11 +09:00
|
|
|
});
|
|
|
|
if (confirm.canceled) return;
|
2022-12-10 07:28:50 +09:00
|
|
|
os.api('i/move', {
|
2022-12-12 10:33:45 +09:00
|
|
|
moveToAccount: account,
|
2022-12-10 07:28:50 +09:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
definePageMetadata({
|
|
|
|
title: i18n.ts.security,
|
|
|
|
icon: 'ph-lock-bold ph-lg',
|
|
|
|
});
|
|
|
|
</script>
|