-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(staff): Convert sudo modal to functional #71100
chore(staff): Convert sudo modal to functional #71100
Conversation
c4ee5d1
to
5bb1a57
Compare
5bb1a57
to
9bbc583
Compare
9bbc583
to
ee1d485
Compare
ee1d485
to
9bbc583
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.
looks generally good to me, feel free to treat comments as nits.
closeModal, | ||
isSuperuser, | ||
location, | ||
needsReload, | ||
router, | ||
retryRequest, | ||
api, | ||
Header, | ||
Body, |
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.
Do we need all of these to be props? For example, we could change router
to:
const router = useRouter();
By importing components and/or using hooks for these props, it helps keep the components signature cleaner and makes the component a little easier to use.
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.
useRouter is deprecated, what should be used instead? we can replace router, api, and location with hooks
try { | ||
await logout(api); | ||
} catch { | ||
// ignore errors | ||
} | ||
window.location.assign(this.getAuthLoginPath()); | ||
window.location.assign(getAuthLoginPath()); |
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.
rather than using window.location
can we use router
to change the history? The difference for the user would be a full page load vs a react page transition. (feel free to ignore this if we need to do a full page load to validate cookies / auth)
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 need one more request to validate 鉀筹笍
Change this component to functional in order to try using
useContext
in a future PR.I removed
busy
because it wasn't used anywhere 馃Props to @michellewzhang for carrying most of the work on this 馃槑