import { component$, useStore, useSignal, $ } from '@builder.io/qwik' import { getDatabase } from 'wildebeest/backend/src/database' import { action$, Form, zod$, z } from '@builder.io/qwik-city' import { addAlias } from 'wildebeest/backend/src/accounts/alias' const zodSchema = zod$({ alias: z.string().min(1), }) export const action = action$(async (data, { platform, json }) => { const db = await getDatabase(platform) const connectedActor = platform.data.connectedActor if (connectedActor === null) { throw json(500, { error: 'user not present in context' }) } try { await addAlias(db, data.alias, connectedActor) } catch (e: unknown) { const error = e as { stack: string; cause: string } console.error(error.stack, error.cause) throw json(500, { error: 'failed to add alias' }) } return { success: true, } }, zodSchema) export default component$(() => { const state = useStore({ alias: '' }) const toast = useSignal<'success' | 'failure' | null>(null) const handleInput = $((event: Event) => { state.alias = (event.target as HTMLInputElement).value }) const saveAction = action() return (

Account Aliases

{toast.value === 'success' && (
Successfully created a new alias. You can now initiate the move from the old account.
)} {toast.value === 'failure' && (
Failed to create alias.
)}

If you want to move from another account to this one, here you can create an alias, which is required before you can proceed with moving followers from the old account to this one. This action by itself is harmless and reversible. The account migration is initiated from the old account.

Specify the username@domain of the account you want to move from
{/*
Handle of the old account
test
Unlink Alias
test 2
Unlink Alias
*/}
) })