Skip to content

Commit

Permalink
clear tracked transaction and toasts on logout
Browse files Browse the repository at this point in the history
  • Loading branch information
DanutIlie committed Jan 25, 2025
1 parent 9b08278 commit 5de971b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/core/managers/ToastManager/ToastManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ export class ToastManager {
}

const eventBus = await this.toastsElement.getEventBus();
console.log('eventBus', eventBus);

if (!eventBus) {
throw new Error(ProviderErrorsEnum.eventBusError);
Expand Down
4 changes: 4 additions & 0 deletions src/store/middleware/logoutMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ import { localStorageKeys } from 'storage/local';
import { accountInfoSelector, isLoggedInSelector } from 'store/selectors';
import { initialState as initialAccountState } from 'store/slices/account/accountSlice';
import { initialState as initialLoginInfoState } from 'store/slices/loginInfo/loginInfoSlice';
import { initialState as initialToastState } from 'store/slices/toast/toastSlice';
import { initialState as initialTrackedTransactionsState } from 'store/slices/trackedTransactions/trackedTransactionsSlice';
import { StoreType } from '../store.types';

export const resetStore = (store: WritableDraft<StoreType>) => {
store.account = initialAccountState;
store.loginInfo = initialLoginInfoState;
store.trackedTransactions = initialTrackedTransactionsState;
store.toasts = initialToastState;
};

export function getNewLoginExpiresTimestamp() {
Expand Down
2 changes: 1 addition & 1 deletion src/store/slices/toast/toastSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { StateCreator } from 'zustand/vanilla';
import { StoreType, MutatorsIn } from 'store/store.types';
import { IToastsSliceState } from './toastSlice.types';

const initialState: IToastsSliceState = {
export const initialState: IToastsSliceState = {
customToasts: [],
transactionToasts: [],
toastProgress: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { StateCreator } from 'zustand/vanilla';
import { StoreType, MutatorsIn } from 'store/store.types';
import { TrackedTransactionsSliceType } from './trackedTransactionsSlice.types';

const initialState: TrackedTransactionsSliceType = {};
export const initialState: TrackedTransactionsSliceType = {};

function getTrackedTransactionsSlice(): StateCreator<
StoreType,
Expand Down

0 comments on commit 5de971b

Please sign in to comment.