Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions static/app/components/superuserStaffAccessForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ class SuperuserStaffAccessForm extends Component<Props, State> {
return;
}

await this.getAuthenticators();
const authenticators = await this.getAuthenticators();
this.setState({authenticators: authenticators});
Copy link
Member

Choose a reason for hiding this comment

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

I don't see this state being modified anywhere else. Does it even need to be state?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would removing it look like this? #70365


// Set the error state if there are no authenticators and U2F is on
if (!this.state.authenticators.length && !disableU2FForSUForm) {
if (!authenticators.length && !disableU2FForSUForm) {
this.handleError(ErrorCodes.NO_AUTHENTICATOR);
}
this.setState({isLoading: false});
Expand Down Expand Up @@ -183,10 +185,11 @@ class SuperuserStaffAccessForm extends Component<Props, State> {

try {
const authenticators = await api.requestPromise('/authenticators/');
this.setState({authenticators: authenticators ?? []});
return authenticators ?? [];
} catch {
// ignore errors
}
return [];
}

render() {
Expand Down