Skip to content

Commit

Permalink
refactor: cleanup type annotations & default values
Browse files Browse the repository at this point in the history
  • Loading branch information
MieszkoTSH committed Jul 4, 2024
1 parent 24e2902 commit 83966ee
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/context/auth/authStorage/AuthStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ const defaultTokenData = {
expires: null,
} satisfies TokenData;
class AuthStorage {
private _storage: Storage | null;
private _tokenData: TokenData = defaultTokenData;
private listeners: VoidFunction[] = [];
private _storage;
private _tokenData: TokenData;
private _listeners: VoidFunction[] = [];

constructor(_storage: Storage) {
try {
Expand All @@ -29,15 +29,15 @@ class AuthStorage {
}

subscribe = (listener: VoidFunction) => {
this.listeners = [...this.listeners, listener];
this._listeners = [...this._listeners, listener];

return () => {
this.listeners = this.listeners.filter((subscriber) => subscriber !== listener);
this._listeners = this._listeners.filter((subscriber) => subscriber !== listener);
};
};

notify() {
this.listeners.forEach((listener) => listener());
private notify() {
this._listeners.forEach((listener) => listener());
}

getTokenData = () => {
Expand Down

0 comments on commit 83966ee

Please sign in to comment.