correção no envio do x-colab
This commit is contained in:
parent
7db4b2a37d
commit
6ff0b11d61
6
main.js
6
main.js
|
|
@ -503,11 +503,11 @@ async function getSelectedOperator() {
|
||||||
async function getSelectedOperatorId() {
|
async function getSelectedOperatorId() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (mainWin && !mainWin.isDestroyed()) {
|
if (mainWin && !mainWin.isDestroyed()) {
|
||||||
mainWin.webContents.executeJavaScript('localStorage.getItem("selectedOperator");')
|
mainWin.webContents.executeJavaScript('localStorage.getItem("idOperator");')
|
||||||
.then(operatorId => resolve(operatorId))
|
.then(operatorId => resolve(operatorId))
|
||||||
.catch(() => resolve(null));
|
.catch(() => resolve(null));
|
||||||
} else if (floatingWin && !floatingWin.isDestroyed()) {
|
} else if (floatingWin && !floatingWin.isDestroyed()) {
|
||||||
floatingWin.webContents.executeJavaScript('localStorage.getItem("selectedOperator");')
|
floatingWin.webContents.executeJavaScript('localStorage.getItem("idOperator");')
|
||||||
.then(operatorId => resolve(operatorId))
|
.then(operatorId => resolve(operatorId))
|
||||||
.catch(() => resolve(null));
|
.catch(() => resolve(null));
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1027,7 +1027,7 @@ ipcMain.handle('get-operators', async () => {
|
||||||
|
|
||||||
const route = apiUrl + 'collaborators';
|
const route = apiUrl + 'collaborators';
|
||||||
|
|
||||||
return new Promise((resolve) => {
|
return new Promise(async (resolve) => {
|
||||||
const headers = {
|
const headers = {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': `Bearer ${token}`
|
'Authorization': `Bearer ${token}`
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "autoatendcolab",
|
"name": "autoatendcolab",
|
||||||
"version": "1.1.8",
|
"version": "1.1.9",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"isBuildNow": true,
|
"isBuildNow": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
|
|
@ -61,13 +61,17 @@ async function initializeSocket() {
|
||||||
|
|
||||||
const tenantId = localStorage.getItem('tenantId');
|
const tenantId = localStorage.getItem('tenantId');
|
||||||
const token = localStorage.getItem('authToken');
|
const token = localStorage.getItem('authToken');
|
||||||
|
const colab = localStorage.getItem('selectedOperator');
|
||||||
|
|
||||||
//! checa se ja tem o colabId e o tenantId
|
//! checa se ja tem o colabId e o tenantId
|
||||||
if (tenantId && token) {
|
if (tenantId && token) {
|
||||||
// Conexão Socket.io adaptada do Pusher
|
// Conexão Socket.io adaptada do Pusher
|
||||||
const socket = io(host, {
|
const socket = io(host, {
|
||||||
auth: { token },
|
auth: { token },
|
||||||
extraHeaders: { 'x-tenant-id': tenantId }
|
extraHeaders: {
|
||||||
|
'x-tenant-id': tenantId,
|
||||||
|
'x-colab': colab || 'N/A'
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('connect', () => {
|
socket.on('connect', () => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue