changed form layout
This commit is contained in:
37
frontend/src/utils/sender.ts
Normal file
37
frontend/src/utils/sender.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
interface FormData {
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
email: string;
|
||||
phoneNumber: string;
|
||||
tickets: number;
|
||||
companyName: string;
|
||||
cmpFirstName: string;
|
||||
cpmLastName: string;
|
||||
cpmEmail: string;
|
||||
cpmPhoneNumber: string;
|
||||
street: string;
|
||||
postalCode: string;
|
||||
paymentMethod: string;
|
||||
code: string;
|
||||
}
|
||||
|
||||
export const submitFormData = async (data: FormData) => {
|
||||
try {
|
||||
const response = await fetch("http://localhost:8004/default/frontend", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text();
|
||||
return { success: false, error: `Server error: ${errorText}` };
|
||||
}
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
return { success: false, error: (error as Error).message };
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user