From e1cd3117b6db9e745137992c85e73f78ad75d7ae Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Sat, 12 Nov 2022 13:43:27 +0100 Subject: [PATCH] fix #33 --- epic-games.js | 1 + util.js | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/epic-games.js b/epic-games.js index c622582..5c22d2c 100644 --- a/epic-games.js +++ b/epic-games.js @@ -17,6 +17,7 @@ const SCREEN_WIDTH = Number(process.env.SCREEN_WIDTH) || 1280; const SCREEN_HEIGHT = Number(process.env.SCREEN_HEIGHT) || 1280; const db = await jsonDb('epic-games.json'); +db.data ||= {}; const migrateDb = (user) => { if (user in db.data || !('claimed' in db.data)) return; db.data[user] = {}; diff --git a/util.js b/util.js index a8c5fc7..644382f 100644 --- a/util.js +++ b/util.js @@ -16,7 +16,6 @@ import { Low, JSONFile } from 'lowdb'; export const jsonDb = async file => { const db = new Low(new JSONFile(dataDir(file))); await db.read(); - db.data ||= {}; return db; };