I'm trying to set up some cookies for my electron application but when the code on the function below executes, this error comes out TypeError: Cannot read properties of undefined (reading 'session').
const { session } = require("electron")
function updatePatient(id) {
session.defaultSession.cookies.set({url: './', name: 'patientId', value: id})
ipcRenderer.send('updatePatientWindow')
}
updatePatient(id)
I also tried to use
const { electron } = require('electron')
electron.session.defaultSession.cookies.set({url: './', name: 'patientId', value: id})
but that doesn't work either
Edit:
Seems like session works only on the main process. A workaround is to use ipcRenderer there to set and read cookies.