fix loggedIn logic

This commit is contained in:
Laurenz Rausche 2024-05-12 19:59:11 +00:00
parent a9da951083
commit d0ac60ef57
2 changed files with 7 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@auth-tools/client",
"version": "0.0.1-alpha.9",
"version": "0.0.1-alpha.10",
"description": "A structured authentication protocol for Javascript. (client)",
"main": "dist/index.js",
"repository": "https://github.com/auth-tools/auth-tools",

View File

@ -95,13 +95,16 @@ export class AuthClient extends AuthBase<
public async isLoggedIn(): Promise<boolean> {
const checkResponse = await this.methods.check({});
if (checkResponse.clientError || checkResponse.res.error) return false;
if (checkResponse.clientError) return false;
if (!checkResponse.res.error) return true;
const refreshResponse = await this.methods.refresh({});
if (refreshResponse.clientError || refreshResponse.res.error) return false;
if (refreshResponse.clientError) return false;
return true;
if (!refreshResponse.res.error) return true;
else return false;
}
//get token payload