refactor: create project

This commit is contained in:
Carlos Valente
2024-06-24 15:55:03 +02:00
committed by Carlos Valente
parent ad69c0ff80
commit 21454947e0
3 changed files with 31 additions and 32 deletions
+3 -3
View File
@@ -88,10 +88,10 @@ const init = async () => {
/**
* Allows to switch the database to a new file
*/
export const switchDb = async (newFileName: string) => {
const { db: newDb, data: newData } = await loadDb(resolveDbDirectory, newFileName);
export const switchDb = async (filePath: string, data: DatabaseModel) => {
const newDb = await JSONFilePreset<DatabaseModel>(filePath, data);
db = newDb;
data = newData;
data = newDb.data;
};
init();