fix: admin org creation - send nested address object instead of flat fields
This commit is contained in:
parent
1da5570e1c
commit
0e6383693c
@ -101,13 +101,20 @@ export default function AdminOrganizationsPage() {
|
|||||||
const apiData = {
|
const apiData = {
|
||||||
name: formData.name,
|
name: formData.name,
|
||||||
type: formData.type as any,
|
type: formData.type as any,
|
||||||
address_street: formData.address.street,
|
address: {
|
||||||
address_city: formData.address.city,
|
street: formData.address.street,
|
||||||
address_postal_code: formData.address.postalCode,
|
city: formData.address.city,
|
||||||
address_country: formData.address.country,
|
postalCode: formData.address.postalCode,
|
||||||
|
country: formData.address.country,
|
||||||
|
...(formData.address.state ? { state: formData.address.state } : {}),
|
||||||
|
},
|
||||||
contact_email: formData.contact_email || undefined,
|
contact_email: formData.contact_email || undefined,
|
||||||
contact_phone: formData.contact_phone || undefined,
|
contact_phone: formData.contact_phone || undefined,
|
||||||
logo_url: formData.logoUrl || undefined,
|
logo_url: formData.logoUrl || undefined,
|
||||||
|
...(formData.siren ? { siren: formData.siren } : {}),
|
||||||
|
...(formData.siret ? { siret: formData.siret } : {}),
|
||||||
|
...(formData.eori ? { eori: formData.eori } : {}),
|
||||||
|
...(formData.scac ? { scac: formData.scac } : {}),
|
||||||
};
|
};
|
||||||
await createOrganization(apiData);
|
await createOrganization(apiData);
|
||||||
await fetchOrganizations();
|
await fetchOrganizations();
|
||||||
|
|||||||
@ -111,10 +111,17 @@ export type OrganizationType = 'FREIGHT_FORWARDER' | 'CARRIER' | 'SHIPPER';
|
|||||||
export interface CreateOrganizationRequest {
|
export interface CreateOrganizationRequest {
|
||||||
name: string;
|
name: string;
|
||||||
type: OrganizationType;
|
type: OrganizationType;
|
||||||
address_street: string;
|
address: {
|
||||||
address_city: string;
|
street: string;
|
||||||
address_postal_code: string;
|
city: string;
|
||||||
address_country: string;
|
state?: string;
|
||||||
|
postalCode: string;
|
||||||
|
country: string;
|
||||||
|
};
|
||||||
|
siren?: string;
|
||||||
|
siret?: string;
|
||||||
|
eori?: string;
|
||||||
|
scac?: string;
|
||||||
contact_email?: string;
|
contact_email?: string;
|
||||||
contact_phone?: string;
|
contact_phone?: string;
|
||||||
logo_url?: string;
|
logo_url?: string;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user