-
Notifications
You must be signed in to change notification settings - Fork 129
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
[10-10CG] Reset csrfToken on 403 response for fetchFacilities #34431
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,10 +125,27 @@ export const fetchFacilities = async ({ | |
}) | ||
.catch(error => { | ||
Sentry.withScope(scope => { | ||
scope.setExtra('error', error); | ||
scope.setExtra('error', error.errors); | ||
Sentry.captureMessage(content['error--facilities-fetch']); | ||
}); | ||
|
||
const errorResponse = error?.errors?.[0]; | ||
|
||
if ( | ||
errorResponse?.status === '403' && | ||
errorResponse?.detail === 'Invalid Authenticity Token' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I only want to trigger this for 403s AND when it is an |
||
) { | ||
Sentry.withScope(scope => { | ||
coope93 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
scope.setLevel(Sentry.Severity.Log); | ||
coope93 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
scope.setExtra('status', errorResponse?.status); | ||
scope.setExtra('detail', errorResponse?.detail); | ||
Sentry.captureMessage( | ||
coope93 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
'Error in fetchFacilities. Clearing csrfToken in localStorage.', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added new Sentry log so we know when these occur and give us more detail into what's going on. |
||
); | ||
}); | ||
localStorage.setItem('csrfToken', ''); | ||
} | ||
|
||
return { | ||
type: 'SEARCH_FAILED', | ||
errorMessage: 'There was an error fetching the health care facilities.', | ||
|
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.
This errors object was just showing
Which is not helpful. This will instead show the error array which has more detail.