Skip to content

Commit

Permalink
fix: fix expires nullish values
Browse files Browse the repository at this point in the history
  • Loading branch information
MieszkoTSH committed Jul 4, 2024
1 parent 83966ee commit e74933d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/context/auth/authStorage/AuthStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ const defaultTokenData = {
} satisfies TokenData;
class AuthStorage {
private _storage;
private _tokenData: TokenData;
private _tokenData;
private _listeners: VoidFunction[] = [];

constructor(_storage: Storage) {
try {
this._storage = _storage;
const expires = _storage.getItem(EXPIRES_KEY);
this._tokenData = {
accessToken: _storage.getItem(ACCESS_TOKEN_KEY),
refreshToken: _storage.getItem(REFRESH_TOKEN_KEY),
expires: Number(_storage.getItem(EXPIRES_KEY)),
expires: expires ? Number(expires) : defaultTokenData.expires,
};
} catch (error) {
this._storage = null;
Expand Down

0 comments on commit e74933d

Please sign in to comment.