fix isLoggedIn

This commit is contained in:
Laurenz Rausche 2024-05-12 18:45:10 +00:00
parent 0856145abb
commit a9da951083
2 changed files with 7 additions and 11 deletions

View File

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

View File

@ -93,19 +93,15 @@ export class AuthClient extends AuthBase<
//check if user is logged in
public async isLoggedIn(): Promise<boolean> {
const checkResponse = await (
this._internal.config.connector as AuthClientConnector<"check">
)("check", {});
const checkResponse = await this.methods.check({});
if (checkResponse.clientError) return false;
if (!checkResponse.res.error) return true;
if (checkResponse.clientError || checkResponse.res.error) return false;
const refreshResponse = await (
this._internal.config.connector as AuthClientConnector<"refresh">
)("refresh", {});
const refreshResponse = await this.methods.refresh({});
if (refreshResponse.clientError) return false;
return !refreshResponse.res.error;
if (refreshResponse.clientError || refreshResponse.res.error) return false;
return true;
}
//get token payload