diff --git a/apps/web/app/(admin)/(authenticated)/magic-link/page.tsx b/apps/web/app/(admin)/(authenticated)/magic-link/page.tsx index d911d56d..49c1bcc2 100644 --- a/apps/web/app/(admin)/(authenticated)/magic-link/page.tsx +++ b/apps/web/app/(admin)/(authenticated)/magic-link/page.tsx @@ -1,15 +1,21 @@ 'use client' +import React from 'react' + import {adminRouterSchema} from '@usevenice/engine-backend/router/adminRouter' import {_trpcReact} from '@usevenice/engine-frontend' -import {SchemaForm, useToast} from '@usevenice/ui' +import {Input, Label, SchemaForm, useToast} from '@usevenice/ui' import {copyToClipboard} from '@/lib-client/copyToClipboard' export default function MagicLinkPage() { const {toast} = useToast() + const [endUserId, setEndUserId] = React.useState('') + const createMagicLink = _trpcReact.adminCreateMagicLink.useMutation({ + trpc: {context: {impersonatedEndUserId: endUserId}}, + meta: {}, onError: (err) => { toast({ title: 'Error creating magic link', @@ -22,6 +28,13 @@ export default function MagicLinkPage() { return (

Magic link

+ + setEndUserId(e.target.value)} + /> +
({ _trpcReact.createClient({ links: [ + () => + ({op, next}) => { + // TODO: Implement impersonation here based on context + console.log('op.context', op.context) + return next(op) + }, (debug ? httpLink : httpBatchLink)({ url: apiUrl ?? '/api/trpc', headers: () => ({