-
-
Notifications
You must be signed in to change notification settings - Fork 202
refactor(reactQuery): adopt Orval's useAccessLogsList DEV-872 #6307
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
base: main
Are you sure you want to change the base?
Conversation
238b275
to
12e60a3
Compare
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.
Overall this is clean and nice, I found one issue though
|
||
// For when it's needed we pass authentication data | ||
if (method === 'DELETE' || data) { | ||
if (method !== 'GET') { |
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.
I think I didn't test this change propertly in the other PR. When I visit /account/security
I get 403 and the list of logs don't appear. Console says:
GET http://kf.local.kbtdev.org/api/v2/access-logs/?limit=10&offset=0 [HTTP/1.1 403 Forbidden 54ms]
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.
hmm, it works for me, both on the PR and main 🤔
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.
Copied from Zulip:
I think I have figured this out finally! There are two things in here:
- On kf.main, when I visit account/security, the network shows call to
/api/v2/access-logs/me/?limit=10&offset=0
but when I visit the PR branch locally, the call is different:/api/v2/access-logs/?limit=10&offset=0
(the difference is/me
part). This was very obvious but it took some time before I have noticed it because I thought this was something more complex :D - Now the puzzle was also why it works for you. I tested it locally on a user created through
/admin
and "log in as". When I logged in as my superuser, everything was fine, or rather the 403 problem didn't happen. It is because the/api/v2/acces-logs/
endpoint is for superusers only. It wasn't available for my regular user. I'm assuming you were testing things with superuser account.
So my guess is that the fix is using useAccessLogsMeList
instead of useAccessLogs
. Unfortunately it requires a bit more work than replacing few lines of code
🗒️ Checklist
#Support Docs Updates
, if any<type>(<scope>)<!>: <title> DEV-1234
Front end
and/orBack end
orworkflow
👀 Preview steps
In short, nothing changes.