rudeshark.net/packages/client/src/pages/settings/migration.vue

69 lines
1.9 KiB
Vue
Raw Normal View History

<template>
<div class="_formRoot">
<FormSection>
<template #label>{{ i18n.ts.moveTo }}</template>
2022-12-12 01:42:40 +01:00
<FormInput v-model="moveToAccount" class="_formBlock">
2023-03-11 22:01:04 +01:00
<template #prefix><i class="ph-airplane-takeoff ph-bold ph-lg"></i></template>
<template #label>{{ i18n.ts.moveToLabel }}</template>
</FormInput>
2022-12-12 02:33:45 +01:00
<FormButton primary danger @click="move(moveToAccount)">
{{ i18n.ts.moveAccount }}
</FormButton>
2022-12-12 03:00:39 +01:00
<div class="description">{{ i18n.ts.moveAccountDescription }}</div>
</FormSection>
<FormSection>
<template #label>{{ i18n.ts.moveFrom }}</template>
<FormInput v-model="accountAlias" class="_formBlock">
2023-03-11 22:01:04 +01:00
<template #prefix><i class="ph-airplane-landing ph-bold ph-lg"></i></template>
<template #label>{{ i18n.ts.moveFromLabel }}</template>
</FormInput>
2022-12-12 03:32:19 +01:00
<FormButton class="button" inline primary @click="save(accountAlias.toString())">
2023-03-11 22:01:04 +01:00
<i class="ph-floppy-disk-back ph-bold ph-lg"></i> {{ i18n.ts.save }}
2022-12-12 02:33:45 +01:00
</FormButton>
2022-12-12 03:00:39 +01:00
<div class="description">{{ i18n.ts.moveFromDescription }}</div>
</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 01:42:40 +01:00
let moveToAccount = $ref('');
let accountAlias = $ref('');
2022-12-12 02:33:45 +01:00
async function save(account): Promise<void> {
2022-12-12 01:42:40 +01:00
os.apiWithDialog('i/known-as', {
2022-12-12 02:33:45 +01:00
alsoKnownAs: account,
2022-12-12 01:42:40 +01:00
});
}
2022-12-12 02:33:45 +01:00
async function move(account): Promise<void> {
2022-12-12 02:28:11 +01:00
const confirm = await os.confirm({
type: 'warning',
2022-12-12 02:33:45 +01:00
text: i18n.t('migrationConfirm', { account: account.toString() }),
2022-12-12 02:28:11 +01:00
});
if (confirm.canceled) return;
2022-12-12 03:18:07 +01:00
os.apiWithDialog('i/move', {
2022-12-12 02:33:45 +01:00
moveToAccount: account,
});
}
definePageMetadata({
title: i18n.ts.security,
2023-03-11 22:01:04 +01:00
icon: 'ph-lock ph-bold ph-lg',
});
</script>
2022-12-12 03:00:39 +01:00
<style lang="scss">
.description {
font-size: .85em;
padding: 1rem;
}
</style>