Merge pull request #108 from dderbentsov/UC-46

Ощистка полей при неверном логине или пароле
This commit is contained in:
frontgavrilin
2022-11-08 15:32:18 +03:00
committed by GitHub

View File

@@ -72,7 +72,6 @@ export default {
changeView() { changeView() {
this.isView = !this.isView; this.isView = !this.isView;
}, },
persist() { persist() {
localStorage.username = this.user.username; localStorage.username = this.user.username;
localStorage.password = this.user.password; localStorage.password = this.user.password;
@@ -88,7 +87,11 @@ export default {
if (result.status === 200) { if (result.status === 200) {
return result.json(); return result.json();
} else { } else {
return (this.authorized = false); this.authorized = false;
if (!this.authorized) {
this.user.username = "";
this.user.password = "";
}
} }
}) })
.then((token) => { .then((token) => {
@@ -101,7 +104,6 @@ export default {
}); });
}, },
}, },
mounted() { mounted() {
if (localStorage.username) this.user.username = localStorage.username; if (localStorage.username) this.user.username = localStorage.username;
if (localStorage.password) this.user.password = localStorage.password; if (localStorage.password) this.user.password = localStorage.password;