Skip to content

Gabrielgyimah - #13

Open
gabrielgyimah wants to merge 7 commits into
dev_frontendfrom
gabrielgyimah
Open

Gabrielgyimah#13
gabrielgyimah wants to merge 7 commits into
dev_frontendfrom
gabrielgyimah

Conversation

@gabrielgyimah

Copy link
Copy Markdown
Collaborator

I implemented the following:

  1. Middleware and related functionality - This is to protect routes we don’t want public users to access. For effectiveness, I made a routes file containing all the routes and put some into a list that are called public, auth or protected routes. The middleware is triggered on every route and based on whether the current route is public or not, it checks if the user is authenticated by an API call to the /validate-token endpoint and give access if user is verified.

  2. User context - For easy access and to prevent unnecessary calls to the user’s endpoint to get user data every time there’s need for it, I implemented the global user context which means when the application loads, a call is made to the backend to retrieve user data once and it is available all through the app by using const { user } = useUser().

  3. Dynamic Organization Context - The dynamic organization context is to make a single organization object available all through the /organization/organizationId route and all of its nested routes like /sales, /purchases, etc.
    it is accessible across the dynamic routes by using just { organization, loading, error } = useOrganization()

Notes: loading is to get a state the data fetching is ongoing so we can perhaps show a loading animation. error is when the organization is not found or an error occurs and we can show them some error or whatever we decide.

Also, the functionality that fetches the organization data uses useEffect and the bug here is that it continues to trigger when the organization is not found. The next step is to work on that.

  1. Complete Login - I’ve connected the login functionalities to the backend and they are fully working.

  2. Complete Sign up - I have also completed the signup functionality.

  3. Password reset - This is also done

  4. A few other functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant