This repository has been archived by the owner on Sep 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjusted precheck logic to also account for missing tables
- Loading branch information
1 parent
3258f42
commit d6ee073
Showing
4 changed files
with
22 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,25 @@ | ||
import { config } from "@/main/Config/config"; | ||
import { TconfigValues } from "@/types/config"; | ||
import { checkOrMakeTables } from "./Database/initializeDatabase"; | ||
|
||
const checkInvalidConfig = async () => { | ||
const loadedConfig = config.store; | ||
const currentProfile = loadedConfig?.current; | ||
const checkInvalidConfig = async (currentProfile: string | undefined | 'default', loadedConfig: TconfigValues) => { | ||
|
||
if(!currentProfile || currentProfile === 'default'){ | ||
const profileIds = Object.keys(loadedConfig.profiles); | ||
config.set('current', profileIds[0]) | ||
} | ||
} | ||
|
||
const checkProfileDatabase = async (currentProfile: string) => { | ||
await checkOrMakeTables(currentProfile) | ||
} | ||
|
||
|
||
|
||
export const preloadCheck = async () => { | ||
await checkInvalidConfig() | ||
const loadedConfig = config.store; | ||
const currentProfile = loadedConfig?.current; | ||
|
||
await checkInvalidConfig(currentProfile, loadedConfig) | ||
await checkProfileDatabase(currentProfile) | ||
} |