F4: add Superadmin SMTP settings client
This commit is contained in:
@@ -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 }),
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user