В каждой функции должен быть setTimeout в Javascript 🙃
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
login() { return new Promise((resolve, reject) => { setTimeout(() => { this.state.isLoggedIn = true; resolve(this.state.isLoggedIn); }, 3000); }); } logout() { return new Promise((resolve, reject) => { setTimeout(() => { this.state.isLoggedIn = false; resolve(this.state.isLoggedIn); }, 3000); }); } |