feat: move database access to rust

This commit is contained in:
PandaDEV 2024-12-11 14:29:05 +10:00
parent 4b3b6eaf21
commit a94496dbdb
No known key found for this signature in database
GPG key ID: 13EFF9BAF70EE75C
5 changed files with 687 additions and 317 deletions

26
plugins/settings.ts Normal file
View file

@ -0,0 +1,26 @@
import { invoke } from "@tauri-apps/api/core";
import type { Settings } from "~/types/types";
export default defineNuxtPlugin(() => {
return {
provide: {
settings: {
async getSetting(key: string): Promise<string> {
return await invoke<string>("get_setting", { key });
},
async saveSetting(key: string, value: string): Promise<void> {
await invoke<void>("save_setting", { key, value });
},
async getKeybind(): Promise<string[]> {
return await invoke<string[]>("get_keybind");
},
async saveKeybind(keybind: string[]): Promise<void> {
await invoke<void>("save_keybind", { keybind });
},
},
},
};
});