Skip to content

Commit

Permalink
Code should be cleared + keep error message to prevent UI shift
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Gilles committed Oct 27, 2023
1 parent 94a418c commit 617e3b7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions front/src/routes/locked/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ class Locked extends Component {
e.preventDefault();
if (this.state.currentCode.length > 0) {
this.setState(prevState => {
return { ...prevState, currentCode: prevState.currentCode.slice(0, -1), wrongCode: false };
return { ...prevState, currentCode: prevState.currentCode.slice(0, -1) };
});
}
};
typeLetter = (e, letter) => {
e.preventDefault();
this.setState(prevState => {
return { ...prevState, currentCode: prevState.currentCode + letter, wrongCode: false };
return { ...prevState, currentCode: prevState.currentCode + letter };
});
};
init = async () => {
Expand Down Expand Up @@ -119,6 +119,7 @@ class Locked extends Component {
console.error(e);
const message = get(e, 'response.data.message');
const status = get(e, 'response.status');
this.setState({ currentCode: '' });
if (status === 429) {
this.setState({
tooManyRequests: true,
Expand Down

0 comments on commit 617e3b7

Please sign in to comment.