summaryrefslogtreecommitdiffhomepage
path: root/packages/tauri/src
diff options
context:
space:
mode:
authorAdam <[email protected]>2025-12-19 07:38:33 -0600
committerAdam <[email protected]>2025-12-19 07:38:38 -0600
commite1ad2a355c84422ef8c6a20f998bc71f2881713a (patch)
treeb37c2dc4ff16bf6d9fcfd83f35a2ff5aea37d5aa /packages/tauri/src
parent4f318f913e034ccd2fe4456461bf56b22a37eed9 (diff)
downloadopencode-e1ad2a355c84422ef8c6a20f998bc71f2881713a.tar.gz
opencode-e1ad2a355c84422ef8c6a20f998bc71f2881713a.zip
fix(desktop): error handling
Diffstat (limited to 'packages/tauri/src')
-rw-r--r--packages/tauri/src/index.tsx10
1 files changed, 9 insertions, 1 deletions
diff --git a/packages/tauri/src/index.tsx b/packages/tauri/src/index.tsx
index 72d119162..dc2c4047d 100644
--- a/packages/tauri/src/index.tsx
+++ b/packages/tauri/src/index.tsx
@@ -5,6 +5,8 @@ import { open, save } from "@tauri-apps/plugin-dialog"
import { open as shellOpen } from "@tauri-apps/plugin-shell"
import { type as ostype } from "@tauri-apps/plugin-os"
import { AsyncStorage } from "@solid-primitives/storage"
+import { fetch as tauriFetch } from "@tauri-apps/plugin-http"
+import { Store } from "@tauri-apps/plugin-store"
import { UPDATER_ENABLED } from "./updater"
import { createMenu } from "./menu"
@@ -57,7 +59,7 @@ const platform: Platform = {
storage: (name = "default.dat") => {
const api: AsyncStorage = {
_store: null,
- _getStore: async () => api._store || (api._store = (await import("@tauri-apps/plugin-store")).Store.load(name)),
+ _getStore: async () => api._store || (api._store = Store.load(name)),
getItem: async (key: string) => (await (await api._getStore()).get(key)) ?? null,
setItem: async (key: string, value: string) => await (await api._getStore()).set(key, value),
removeItem: async (key: string) => await (await api._getStore()).delete(key),
@@ -82,9 +84,15 @@ const platform: Platform = {
update: async () => {
if (!UPDATER_ENABLED || !update) return
await update.install()
+ },
+
+ restart: async () => {
await invoke("kill_sidecar")
await relaunch()
},
+
+ // @ts-expect-error
+ fetch: tauriFetch,
}
createMenu()