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

Factories Loaders and Token Validity #746

Merged
merged 10 commits into from
Apr 26, 2024
Merged

Factories Loaders and Token Validity #746

merged 10 commits into from
Apr 26, 2024

Conversation

lowtorola
Copy link
Contributor

@lowtorola lowtorola commented Feb 15, 2024

This PR does the following:

  • Refactors all API hook keys and functions to "factories," which make these able to be used in various places.
    • compete factories
    • user factories
    • team factories
    • episode factories
  • Adds React Router Loader Functions for each page in our frontend! 🎉
    • Submissions
    • MyTeam
    • Scrimmaging
    • Rankings
    • Queue
    • Tournaments
    • Tournament
    • Home
  • Checks for token presence/validity before checking for the current episode's info or current team/user info

Need to test:

  • Test behavior of invalid token
  • Try making a queryFn called in a loader throw an Error/ResponseError, verify that it toasts as desired

@lowtorola
Copy link
Contributor Author

Not to toot my own horn but that commit is pretty epic some real late night success 😎

@lowtorola lowtorola marked this pull request as ready for review March 12, 2024 14:41
@acrantel
Copy link
Member

Great job! I skimmed the code and it looks good, is there anything specific in this PR you'd want me to take a look at?

@lowtorola
Copy link
Contributor Author

@acrantel I fixed the token validity issue!! Basically just added an await in App.tsx that blocks app loading until we verify that the token is valid. Lmk if you think this is fine (performance seemed just fine to me). I had to change the target in tsconfig.json to es2017 though, is that fine? 😎

Copy link
Member

@acrantel acrantel left a comment

Choose a reason for hiding this comment

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

:shipit:

@lowtorola lowtorola merged commit e494b4c into main Apr 26, 2024
3 checks passed
@lowtorola lowtorola deleted the api-factories branch April 26, 2024 17:26
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.

2 participants