fix: redirect to home after login
This commit is contained in:
@ -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()
|
||||
|
Reference in New Issue
Block a user