Skip to content

Commit

Permalink
chore: clear when logout / reset
Browse files Browse the repository at this point in the history
  • Loading branch information
LuizAsFight committed Dec 11, 2024
1 parent f796418 commit 108f46f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const accountsMachine = createMachine(
cond: 'hasAccountsOrNeedsRecovery',
},
{
target: 'idle',
target: 'fetchingAccount',
actions: ['assignAccounts'],
},
],
Expand Down Expand Up @@ -119,11 +119,6 @@ export const accountsMachine = createMachine(
actions: 'assignError',
target: 'failed',
},
{
target: 'idle',
actions: ['assignAccount'],
cond: 'hasAccount',
},
{
target: 'idle',
actions: ['assignAccount'],
Expand Down
3 changes: 3 additions & 0 deletions packages/app/src/systems/Core/services/chromeStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,7 @@ export const chromeStorage = {
accounts: new ChromeStorageTable<Account>('accounts'),
networks: new ChromeStorageTable<NetworkData>('networks'),
vaults: new ChromeStorageTable<Vault>('vaults'),
clear: () => {
chrome?.storage?.local?.clear();
}
};
2 changes: 2 additions & 0 deletions packages/app/src/systems/Core/services/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import { VaultService } from '~/systems/Vault';
import { delay } from '../utils';
import { db } from '../utils/database';
import { Storage } from '../utils/storage';
import { chromeStorage } from './chromeStorage';

// biome-ignore lint/complexity/noStaticOnlyClass: <explanation>
export class CoreService {
static async clear() {
toast.success('Your wallet will be reset');
await delay(1500);
await chromeStorage.clear();
await VaultService.clear();
await db.clear();
await Storage.clear();
Expand Down

0 comments on commit 108f46f

Please sign in to comment.