From f33dc64b06bec2e5afd20138c284208ee67c1f1f Mon Sep 17 00:00:00 2001 From: Nelito Junior Date: Sun, 22 Dec 2024 00:29:14 -0300 Subject: [PATCH] Update database.ts --- packages/app/src/systems/Core/utils/database.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/app/src/systems/Core/utils/database.ts b/packages/app/src/systems/Core/utils/database.ts index 9fb11e111..916529b05 100644 --- a/packages/app/src/systems/Core/utils/database.ts +++ b/packages/app/src/systems/Core/utils/database.ts @@ -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; export type FuelCachedAsset = AssetData & @@ -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 (_) {}