Restart GUI when we get API key
This commit is contained in:
		| @@ -32,7 +32,10 @@ ipcMain.on('submit-api-key', (event, apiKey) => { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     fs.writeFileSync(configPath, JSON.stringify({ API_KEY: apiKey }, null, 2), 'utf8'); |     fs.writeFileSync(configPath, JSON.stringify({ API_KEY: apiKey }, null, 2), 'utf8'); | ||||||
|     event.sender.send('api-key-saved'); |     event.reply('api-key-saved'); | ||||||
|  |  | ||||||
|  |     app.relaunch(); | ||||||
|  |     app.quit(); | ||||||
| }); | }); | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -2,8 +2,5 @@ const { contextBridge, ipcRenderer } = require('electron'); | |||||||
|  |  | ||||||
| contextBridge.exposeInMainWorld('electronAPI', { | contextBridge.exposeInMainWorld('electronAPI', { | ||||||
|     sendPrompt: (prompt) => ipcRenderer.invoke('send-prompt', prompt), |     sendPrompt: (prompt) => ipcRenderer.invoke('send-prompt', prompt), | ||||||
|  |     onApiKeySaved: (callback) => ipcRenderer.on('api-key-saved', callback), | ||||||
| }); | }); | ||||||
|  |  | ||||||
| contextBridge.exposeInMainWorld('api', { |  | ||||||
|     submitApiKey: (apiKey) => ipcRenderer.send('submit-api-key', apiKey) |  | ||||||
| }); |  | ||||||
| @@ -2,6 +2,7 @@ | |||||||
| <html> | <html> | ||||||
| <head> | <head> | ||||||
|   <title>Enter API Key</title> |   <title>Enter API Key</title> | ||||||
|  |   <link rel="stylesheet" href="css/styles.css"> | ||||||
| </head> | </head> | ||||||
| <body> | <body> | ||||||
|   <h1>Enter API Key</h1> |   <h1>Enter API Key</h1> | ||||||
| @@ -16,4 +17,4 @@ | |||||||
|     }); |     }); | ||||||
|   </script> |   </script> | ||||||
| </body> | </body> | ||||||
| </html> | </html> | ||||||
		Reference in New Issue
	
	Block a user