This pull request introduces several enhancements to the expense management application, focusing on improving the handling of expense groups and invitations. The key changes include:
Refactoring the way expense groups are fetched using a custom hook.
Improving the Invitation interface to better represent relationships with users and expense groups.
Making invitations dynamic, allowing users to accept or decline them with buttons, with the state refreshing on each action.
Changes Made
Expense Groups
Custom Hook: Created a custom hook useExpenseGroups to encapsulate the logic for fetching expense groups based on the user's ID.
Home Page: Updated the Home component to use the new useExpenseGroups hook, enhancing readability and maintainability.
Invitations
Interface Update: Modified the Invitation interface to include relationships with User and ExpenseGroup types.
Changed the status property from a union type ('Pending' | 'Accepted' | 'Rejected') to a string for flexibility.
Added sender and expenseGroup properties to provide context and related data for each invitation.
Dynamic Invitations: Implemented functionality to accept or decline invitations with buttons, ensuring that the invitation state is refreshed after each action.
Benefits
Code Reusability: The introduction of the useExpenseGroups hook improves code reusability across components that need to fetch expense groups.
Data Structure: The enhanced Invitation interface offers a clearer representation of relationships, which facilitates better data handling and improves overall application structure.
User Interaction: The dynamic invitation feature enhances user engagement by allowing real-time responses to invitations, improving the overall user experience.
Overview
This pull request introduces several enhancements to the expense management application, focusing on improving the handling of expense groups and invitations. The key changes include:
Invitation
interface to better represent relationships with users and expense groups.Changes Made
Expense Groups
useExpenseGroups
to encapsulate the logic for fetching expense groups based on the user's ID.Home
component to use the newuseExpenseGroups
hook, enhancing readability and maintainability.Invitations
Invitation
interface to include relationships withUser
andExpenseGroup
types.status
property from a union type ('Pending' | 'Accepted' | 'Rejected'
) to a string for flexibility.sender
andexpenseGroup
properties to provide context and related data for each invitation.Benefits
useExpenseGroups
hook improves code reusability across components that need to fetch expense groups.Invitation
interface offers a clearer representation of relationships, which facilitates better data handling and improves overall application structure.