'use client' import { useActionState, useState } from 'react' import Link from 'next/link' import { createLicenseAction, type CreateLicenseState } from '../actions' import type { CustomerOption } from '@/lib/supabaseAdmin' const initialState: CreateLicenseState = {} export default function NewLicenseForm({ customers }: { customers: CustomerOption[] }) { const [state, formAction, pending] = useActionState(createLicenseAction, initialState) const [copied, setCopied] = useState(false) if (state.result) { const { id, licenseKey } = state.result return (
{licenseKey}