refactor: extract model flag and simplify config return type
This commit is contained in:
parent
6dc55bc3f3
commit
d327ed614a
2 changed files with 9 additions and 8 deletions
|
|
@ -8,16 +8,14 @@ export interface AppConfig {
|
|||
model?: string;
|
||||
}
|
||||
|
||||
export async function loadConfig(): Promise<{
|
||||
config: AppConfig;
|
||||
}> {
|
||||
export async function loadConfig(): Promise<AppConfig> {
|
||||
let config: AppConfig;
|
||||
try {
|
||||
config = await configFile.json();
|
||||
} catch {
|
||||
config = {};
|
||||
}
|
||||
return { config };
|
||||
return config;
|
||||
}
|
||||
|
||||
export async function saveConfig(config: AppConfig): Promise<void> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue