Skip to content

Commit

Permalink
feat(expense): added verification to front end creation form
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethan-C11 committed Sep 3, 2024
1 parent b92768f commit 7958f61
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion api-server/src/resources/expense/ExpenseService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export class ExpenseService {
}

const result: any = await ExpenseRepository.createExpenseDemand(expense);
return new ControllerResponse(200, "Demande de frais créé");
return new ControllerResponse(200, "Demande de frais créée");
} catch (error) {
logger.error(`Failed to create expenses. Error: ${error}`);
return new ControllerResponse(
Expand Down
8 changes: 8 additions & 0 deletions react-app/src/modules/expense/pages/CreateExpense.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ export function CreateExpense() {
};

const handleFormSubmit = async (e: React.MouseEvent<HTMLButtonElement>) => {
if (
createdExpense.type === "" ||
createdExpense.amount === "" ||
createdExpense.motivation === ""
) {
toast.error("Veuillez compléter tous les champs du formulaire");
return;
}
e.preventDefault();
createdExpense.facturation_date.setHours(3);
const date = createdExpense.facturation_date.toISOString().split("T")[0];
Expand Down

0 comments on commit 7958f61

Please sign in to comment.