Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds state storage and frontend APIs that wrap backend endpoint calls #16

Merged
merged 3 commits into from
May 12, 2024

Conversation

jhodapp
Copy link
Member

@jhodapp jhodapp commented May 10, 2024

Description

This PR adds two Zustand state stores. One that stores the user's UUID as session state, and the other that will be used to store more general application state that must reside on the frontend.

It also adds a frontend API that makes calls to the backend endpoints using Axios for user logging in/out and the full Organizations CRUD API.

GitHub Issue: N/A

Changes

  • Adds a Zustand state store to keep track of the current user's UUID and provides login/logout functions to manage this state
  • Adds a Zustand state store for general state storage for the rest of the application
  • Adds a frontend API to call login/logout endpoints on the backend
  • Adds a frontend API to call all current Organization entity CRUD endpoints

Screenshots / Videos Showing UI Changes (if applicable)

N/A

Testing Strategy

  1. Login using one of the seeded test users, notice that login/logout still works as expected
  2. Uncomment the "unit tests" in the top of the coaching-sessions/page.tsx source to test out all Organization entity CRUD endpoints.
  3. Note that try to delete an Organization doesn't work when it has a foreign key relationship established to a coaching_relationship entry

Concerns

  1. The Zustand store doesn't currently survive a page refresh. This needs to be fixed for the store to be really useful. I haven't been able to figure this out yet in spite of spending quite a bit of time trying. It may be most helpful to reach out to the Zustand community for some guidance.

  2. I'm not happy with the error handling of returned errors by the backend when calling Organization entity endpoints. This is just a limitation of my lack of experience in writing good Typescript.

  3. Some of this code is a somewhat less than ideal early version meant to set a vision and rapidly iterate on it in tandem with an evolving backend.

…te. Also adds a frontend API that makes API calls using Axios to the backend for user logging in/out and the full Organizations CRUD API
@jhodapp jhodapp added enhancement Improves existing functionality or feature feature work Specifically implementing a new feature labels May 10, 2024
@jhodapp jhodapp self-assigned this May 10, 2024
@jhodapp jhodapp requested a review from calebbourg May 10, 2024 01:44
… it's having component rendering/state issues that need a much deeper look.
Copy link
Collaborator

@calebbourg calebbourg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to run this locally and everything continues to function well! Nice work!

@jhodapp
Copy link
Member Author

jhodapp commented May 12, 2024

I was able to run this locally and everything continues to function well! Nice work!

Why thank you, that's great news.

@jhodapp jhodapp merged commit 777c852 into main May 12, 2024
1 check passed
@jhodapp jhodapp deleted the add_state_store branch May 12, 2024 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improves existing functionality or feature feature work Specifically implementing a new feature
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants