Skip to content

Commit

Permalink
Update database.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
nelitow committed Dec 22, 2024
1 parent 7fcfee7 commit f33dc64
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/app/src/systems/Core/utils/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import type {
import Dexie, { type DbEvents, type PromiseExtended, type Table } from 'dexie';
import 'dexie-observable';
import type { AssetFuel } from 'fuels';
import { IS_LOGGED_KEY } from '~/config';
import { createParallelDb } from '~/systems/Core/utils/databaseNoDexie';
import { Storage } from '~/systems/Core/utils/storage';
import type { TransactionCursor } from '~/systems/Transaction';
import { chromeStorage } from '../services/chromeStorage';
import { applyDbVersioning } from './databaseVersioning';
import { createParallelDb } from '~/systems/Core/utils/databaseNoDexie';
import { IS_LOGGED_KEY } from '~/config';
import { Storage } from '~/systems/Core/utils/storage';

type FailureEvents = Extract<keyof DbEvents, 'close' | 'blocked'>;
export type FuelCachedAsset = AssetData &
Expand Down Expand Up @@ -95,9 +95,11 @@ export class FuelDB extends Dexie {

try {
(async () => {
const accounts = await this.accounts.toArray();
if (accounts.length) {
Storage.setItem(IS_LOGGED_KEY, true);
if (typeof window !== 'undefined' && window.localStorage) {
const accounts = await this.accounts.toArray();
if (accounts.length) {
Storage.setItem(IS_LOGGED_KEY, true);
}
}
})();
} catch (_) {}
Expand Down

0 comments on commit f33dc64

Please sign in to comment.