diff --git a/src/main/index.ts b/src/main/index.ts index ac456f6..d107009 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -15,7 +15,7 @@ function createWindow(): void { title: 'JRedisDesktop', backgroundColor: nativeTheme.shouldUseDarkColors ? '#0f0f1a' : '#f8fafc', webPreferences: { - preload: join(__dirname, '../preload/index.js'), + preload: join(__dirname, '../preload/index.mjs'), contextIsolation: true, nodeIntegration: false, sandbox: false, diff --git a/src/renderer/src/stores/connection.ts b/src/renderer/src/stores/connection.ts index 7479fc8..5ea0058 100644 --- a/src/renderer/src/stores/connection.ts +++ b/src/renderer/src/stores/connection.ts @@ -126,6 +126,9 @@ export const useConnectionStore = defineStore('connection', () => { async function testConnection(opts: { host: string; port: number; auth?: string; username?: string; tls?: boolean }): Promise<{ success: boolean; error?: string }> { + if (!window.electronAPI) { + return { success: false, error: 'Electron API not ready' } + } const testId = `test_${Date.now()}` try { const result = await window.electronAPI.redis.connect(testId, {