From 617e3b7c9cf61200ea5468ee95c7d6feae976adc Mon Sep 17 00:00:00 2001 From: Pierre-Gilles Leymarie Date: Fri, 27 Oct 2023 17:24:46 +0200 Subject: [PATCH] Code should be cleared + keep error message to prevent UI shift --- front/src/routes/locked/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/front/src/routes/locked/index.js b/front/src/routes/locked/index.js index 5666a8b9e6..9e53e982ad 100644 --- a/front/src/routes/locked/index.js +++ b/front/src/routes/locked/index.js @@ -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 () => { @@ -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,