Build post chat and attachment workflows
This commit is contained in:
@@ -26,6 +26,7 @@ export function UsersView({ clients }: UsersViewProps) {
|
||||
const [role, setRole] = useState<Invitation["role"]>("agency_user");
|
||||
const [clientId, setClientId] = useState("");
|
||||
const [createdURL, setCreatedURL] = useState("");
|
||||
const [inviteStatus, setInviteStatus] = useState("");
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
const [error, setError] = useState("");
|
||||
@@ -59,6 +60,7 @@ export function UsersView({ clients }: UsersViewProps) {
|
||||
setIsSubmitting(true);
|
||||
setError("");
|
||||
setCreatedURL("");
|
||||
setInviteStatus("");
|
||||
try {
|
||||
const invitation = await createInvitation(token, {
|
||||
email,
|
||||
@@ -69,6 +71,11 @@ export function UsersView({ clients }: UsersViewProps) {
|
||||
setEmail("");
|
||||
setClientId("");
|
||||
setCreatedURL(invitation.invitation_url ?? "");
|
||||
setInviteStatus(
|
||||
invitation.email_sent
|
||||
? "Convite criado e e-mail enviado."
|
||||
: invitation.email_error || "Convite criado. Configure o SMTP para enviar por e-mail ou copie o link abaixo.",
|
||||
);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : "Não foi possível criar o convite.");
|
||||
} finally {
|
||||
@@ -144,6 +151,12 @@ export function UsersView({ clients }: UsersViewProps) {
|
||||
</Button>
|
||||
</form>
|
||||
|
||||
{inviteStatus && (
|
||||
<div className="mt-4 rounded-lg border border-border bg-muted/30 px-3 py-2 text-sm text-muted-foreground">
|
||||
{inviteStatus}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{createdURL && (
|
||||
<div className="mt-4 rounded-lg border border-border bg-muted/30 p-3">
|
||||
<div className="text-xs font-medium text-muted-foreground mb-2">Link do convite</div>
|
||||
|
||||
Reference in New Issue
Block a user