/** * Custom Domains API - Manage custom domains for businesses */ import apiClient from './client'; import { CustomDomain } from '../types'; /** * Get all custom domains for the current business */ export const getCustomDomains = async (): Promise => { const response = await apiClient.get('/business/domains/'); return response.data; }; /** * Add a new custom domain */ export const addCustomDomain = async (domain: string): Promise => { const response = await apiClient.post('/business/domains/', { domain: domain.toLowerCase().trim(), }); return response.data; }; /** * Delete a custom domain */ export const deleteCustomDomain = async (domainId: number): Promise => { await apiClient.delete(`/business/domains/${domainId}/`); }; /** * Verify a custom domain by checking DNS */ export const verifyCustomDomain = async (domainId: number): Promise<{ verified: boolean; message: string }> => { const response = await apiClient.post<{ verified: boolean; message: string }>( `/business/domains/${domainId}/verify/` ); return response.data; }; /** * Set a custom domain as the primary domain */ export const setPrimaryDomain = async (domainId: number): Promise => { const response = await apiClient.post( `/business/domains/${domainId}/set-primary/` ); return response.data; };