feat: enhance user confirmation and data submission; add newEntry function and update MainForm to handle user selection
This commit is contained in:
@@ -14,9 +14,9 @@ interface FormData {
|
||||
paymentMethod: string;
|
||||
}
|
||||
|
||||
export const submitFormData = async (data: FormData) => {
|
||||
export const submitFormData = async (data: FormData, username: string) => {
|
||||
try {
|
||||
const response = await fetch("/backend/default/frontend", {
|
||||
const response = await fetch(`http://localhost:8004/default/new-entry?username=${username}`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -27,7 +27,7 @@ export const submitFormData = async (data: FormData) => {
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text();
|
||||
return { success: false, error: `Server error: ${errorText}` };
|
||||
}
|
||||
}
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user