feat: connection notification

This commit is contained in:
Timothy J. Baek
2024-03-13 00:08:42 -07:00
parent f5e8dcfbbf
commit 51d339b8a7
4 changed files with 12 additions and 2 deletions

View File

@@ -6,7 +6,7 @@ import { ref, onBeforeMount } from 'vue';
const url = ref('http://localhost:3000')
const token = ref('your_jwt')
const submitHandler = () => {
const submitHandler = async () => {
console.log(url.value, token.value)
@@ -20,6 +20,12 @@ const submitHandler = () => {
token: token.value
})
const res = await window.electron.checkConnection()
new Notification("Open WebUI", { body: res ? 'Server Connection Verified' : 'Server Connection Failed' })
console.log(res)
}
@@ -30,6 +36,8 @@ onBeforeMount(async () => {
url.value = res.url
token.value = res.token
}
})

View File

@@ -2,6 +2,7 @@ import {
app,
BrowserWindow,
globalShortcut,
Notification,
clipboard,
ipcMain,
} from "electron";

View File

@@ -8,6 +8,7 @@ contextBridge.exposeInMainWorld("electron", {
ipcRenderer.on(event, callback);
},
checkConnection: () => ipcRenderer.invoke("check-connection"),
loadConfig: () => ipcRenderer.invoke("load-config"),
saveConfig: (data) => ipcRenderer.send("save-config", data),
});