F4: add Superadmin SMTP settings client

This commit is contained in:
2026-09-07 23:13:24 -03:00
parent b69b773094
commit 8d962e783d
+46
View File
@@ -0,0 +1,46 @@
import { apiRequest } from './api';
export type SmtpSecurityMode = 'NONE' | 'STARTTLS' | 'TLS';
export interface PublicSmtpSettings {
source: 'DATABASE' | 'ENVIRONMENT' | 'NONE';
id?: string;
host?: string;
port?: number;
securityMode?: SmtpSecurityMode;
username?: string | null;
hasPassword?: boolean;
fromName?: string | null;
fromEmail?: string;
replyTo?: string | null;
enabled: boolean;
updatedAt?: string;
}
export function getSmtpSettings() {
return apiRequest<PublicSmtpSettings>('/document-delivery/smtp');
}
export function saveSmtpSettings(input: {
host: string;
port: number;
securityMode: SmtpSecurityMode;
username?: string | null;
password?: string | null;
fromName: string;
fromEmail: string;
replyTo?: string | null;
enabled: boolean;
}) {
return apiRequest<PublicSmtpSettings>('/document-delivery/smtp', {
method: 'PUT',
body: JSON.stringify(input),
});
}
export function testSmtpSettings(email: string) {
return apiRequest<{ ok: boolean; recipient: string; messageId: string }>('/document-delivery/smtp/test', {
method: 'POST',
body: JSON.stringify({ email }),
});
}