feat: standardize contact formatting
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { formatPhone } from '~/utils/formatters/phone';
|
||||
|
||||
export interface ConstructeurSummary {
|
||||
id: string;
|
||||
name?: string | null;
|
||||
@@ -92,8 +94,16 @@ export const resolveConstructeurs = (
|
||||
|
||||
export const formatConstructeurContact = (
|
||||
constructeur?: ConstructeurSummary | null,
|
||||
): string =>
|
||||
[constructeur?.email, constructeur?.phone].filter(Boolean).join(' • ');
|
||||
): string => {
|
||||
if (!constructeur) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const formattedPhone = formatPhone(constructeur.phone);
|
||||
const phone = formattedPhone || constructeur.phone || null;
|
||||
|
||||
return [constructeur.email, phone].filter(Boolean).join(' • ');
|
||||
};
|
||||
|
||||
export const buildConstructeurRequestPayload = <T extends Record<string, any>>(
|
||||
payload: T,
|
||||
|
||||
Reference in New Issue
Block a user