Skip to content
Snippets Groups Projects
Commit 34b9d27a authored by Bo-Chun Chen's avatar Bo-Chun Chen
Browse files

Unset timer when time go to minus

parent 28f38b8b
No related branches found
No related tags found
No related merge requests found
......@@ -69,10 +69,13 @@ function Main(props) {
socket.on('created', data => {
if (DEBUG) console.log('account has been created.')
let sec = 3;
let myTimer;
(function countdown () {
setModalTitle("Your account is ready!");
setModalBody(`Will redirect in ${sec--} seconds.`);
setTimeout(countdown, 1000);
myTimer = setTimeout(countdown, 1000);
if (sec < 0)
clearTimeout(myTimer);
})()
setTimeout(() => {
if (DEBUG) console.log('Redirecting to /test')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment