improved register page

This commit is contained in:
AdrienLSH
2024-01-11 13:03:43 +01:00
parent cd82162ebe
commit 49c1288a0b
2 changed files with 30 additions and 11 deletions

View File

@ -20,7 +20,7 @@ class Account
if (response_data == "user created")
{
this._logged = true;
await this.client._update_logged(true);
return null;
}
return response_data
@ -31,13 +31,13 @@ class Account
let response = await this.client._delete("/api/accounts/delete", {password: password});
let response_data = await response.json();
if (JSON.stringify(response_data) == JSON.stringify({'detail': 'Authentication credentials were not provided.'}))
if (response.status === 403)
{
this.client._update_logged(false);
return null;
return null;
}
if (response_data == "user deleted")
this.client._logged = false;
this.client._update_logged(false);
return response_data;
}
@ -46,10 +46,10 @@ class Account
let response = await this.client._get("/api/accounts/edit");
let response_data = await response.json();
if (JSON.stringify(response_data) == JSON.stringify({'detail': 'Authentication credentials were not provided.'}))
if (response.status === 403)
{
this.client._logged = false;
return null;
this.client._update_logged(false);
return null;
}
return response_data;
}
@ -60,13 +60,13 @@ class Account
let response = await this.client._patch_json("/api/accounts/edit", data);
let response_data = await response.json();
if (JSON.stringify(response_data) == JSON.stringify({'detail': 'Authentication credentials were not provided.'}))
if (response.status === 403)
{
this.client._;
this.client._update_logged(false);
return null;
}
return response_data;
}
}
export { Account }
export { Account }