feat: complete stage 1 infrastructure
This commit is contained in:
52
src/lib/api/settings.ts
Normal file
52
src/lib/api/settings.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import type { Settings } from "@/types";
|
||||
import type { AppType } from "./types";
|
||||
|
||||
export const settingsApi = {
|
||||
async get(): Promise<Settings> {
|
||||
return await invoke("get_settings");
|
||||
},
|
||||
|
||||
async save(settings: Settings): Promise<boolean> {
|
||||
return await invoke("save_settings", { settings });
|
||||
},
|
||||
|
||||
async restart(): Promise<boolean> {
|
||||
return await invoke("restart_app");
|
||||
},
|
||||
|
||||
async checkUpdates(): Promise<void> {
|
||||
await invoke("check_for_updates");
|
||||
},
|
||||
|
||||
async isPortable(): Promise<boolean> {
|
||||
return await invoke("is_portable_mode");
|
||||
},
|
||||
|
||||
async getConfigDir(appType: AppType): Promise<string> {
|
||||
return await invoke("get_config_dir", {
|
||||
app_type: appType,
|
||||
app: appType,
|
||||
});
|
||||
},
|
||||
|
||||
async openConfigFolder(appType: AppType): Promise<void> {
|
||||
await invoke("open_config_folder", { app_type: appType, app: appType });
|
||||
},
|
||||
|
||||
async selectConfigDirectory(defaultPath?: string): Promise<string | null> {
|
||||
return await invoke("pick_directory", { default_path: defaultPath });
|
||||
},
|
||||
|
||||
async getClaudeCodeConfigPath(): Promise<string> {
|
||||
return await invoke("get_claude_code_config_path");
|
||||
},
|
||||
|
||||
async getAppConfigPath(): Promise<string> {
|
||||
return await invoke("get_app_config_path");
|
||||
},
|
||||
|
||||
async openAppConfigFolder(): Promise<void> {
|
||||
await invoke("open_app_config_folder");
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user