fix: redirect to home after login

This commit is contained in:
AdrienLSH
2024-01-09 19:55:55 +01:00
parent 56d352fead
commit 8eb54d0f14
2 changed files with 13 additions and 16 deletions

View File

@ -34,8 +34,8 @@ class Client
async isAuthentificate()
{
if (this._logged == undefined)
this.logged = await this._test_logged();
return this.logged;
this._logged = await this._test_logged();
return this._logged;
}
async _get(uri, data)
@ -100,7 +100,7 @@ class Client
async _update_logged(state)
{
if (this.logged == state)
if (this._logged == state)
return;
if (state)
@ -112,19 +112,16 @@ class Client
{
this.me = undefined;
}
this.logged = state;
this._logged = state;
}
async login(username, password)
{
let response = await this._post("/api/accounts/login", {username: username, password: password})
if (response.status != 200)
return response.status;
if (response.status == 200)
await this._update_logged(true);
this._update_logged(true);
return 0;
return response.status;
}
async logout()