-
Notifications
You must be signed in to change notification settings - Fork 9
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
Call API with add and remove buttons, refine loading and error strategies (#181, 191) #196
Call API with add and remove buttons, refine loading and error strategies (#181, 191) #196
Conversation
f581348
to
57d1c36
Compare
body: JSON.stringify(body), | ||
headers: { | ||
...BASE_MUTATION_HEADERS, | ||
'X-CSRFTOKEN': getCSRFToken() ?? '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could maybe throw an error in getCSRFToken
instead, but it seems unlikely that the CSRF token won't be there. And this would still have a clear result, the call would fail with a missing CSRF token message.
defaultOptions: { | ||
queries: { | ||
retry: false, | ||
retryOnMount: false, | ||
staleTime: Infinity | ||
}, | ||
mutations: { retry: false } | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
react-query
includes a lot of retry and refetch behavior by default. We may want some of this eventually, but for now I thought it seemed unnecessary and easier for testing to disable it all. See https://react-query.tanstack.com/guides/important-defaults
09583dd
to
e2f2b94
Compare
…kie; add updateToolNav api call; wire up buttons; refactor error and loading handling
7e3fea5
to
2c09eb4
Compare
FYI, I fixed a styling-related issue, resulting in some extra empty space on the tool cards. Should be resolved now. See b82eab2 |
Not sure where the 'extra empty space' was. b82eab2 looks good to me. |
This PR aims to resolve #181 and #191.
More details
api
module.js-cookie
and process for adding a CSRF token to headers.react-query
for handling asynchronous-related state (useQuery
,useMutation
).ErrorsDisplay
).eslint
plugin forreact-hooks
.Resources