mirror of
https://github.com/lucaspalomodevelop/auth-tools.git
synced 2026-03-13 06:09:37 +00:00
fix isLoggedIn
This commit is contained in:
parent
0856145abb
commit
a9da951083
@ -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",
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user