-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreload.js
32 lines (21 loc) · 1.27 KB
/
preload.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const { contextBridge, ipcRenderer } = require("electron");
const Toastify = require('toastify-js');
const axios = require("axios");
const supabase = require('@supabase/supabase-js');
contextBridge.exposeInMainWorld('axios', {
history: (method, note_id, id, token, data) => ipcRenderer.invoke('axios.history', method, note_id, id, token, data),
chatbot: (text, token, jinn) => ipcRenderer.invoke('axios.chatbot', text, token, jinn),
chat: (method, data, token) => ipcRenderer.invoke('axios.chat',method, data, token),
user: (method, data, token) => ipcRenderer.invoke('axios.user', method, data, token),
login: (path, data, token) => ipcRenderer.invoke('axios.login', path, data, token),
notes: (method, token, id, data) => ipcRenderer.invoke('axios.notes', method, token, id, data),
quiz: (data, token) => ipcRenderer.invoke('axios.quiz', data, token),
bet: (transaction_code, combination) => ipcRenderer.invoke('axios.bet', transaction_code, combination),
});
contextBridge.exposeInMainWorld("Toastify", {
showToast: (options) => Toastify(options).showToast()
});
contextBridge.exposeInMainWorld("signup", {
create: (email, password) => ipcRenderer.invoke('signup.create', email, password),
profile: () => ipcRenderer.invoke('signup.profile')
});