Commit 12fa1369 authored by Patricio Bruna's avatar Patricio Bruna

Add token to companies Request - fix 87

parent ec3c99ca
...@@ -47,6 +47,7 @@ function initZimbra() { ...@@ -47,6 +47,7 @@ function initZimbra() {
if (zimbra && token) { if (zimbra && token) {
window.manager_config.dns.token = token; window.manager_config.dns.token = token;
window.manager_config.user_token = token;
return resolve(zimbra); return resolve(zimbra);
} else if (token) { } else if (token) {
zimbra = new ZimbraAdminApi({ zimbra = new ZimbraAdminApi({
...@@ -55,6 +56,7 @@ function initZimbra() { ...@@ -55,6 +56,7 @@ function initZimbra() {
zimbra.client.token = token; zimbra.client.token = token;
ZimbraStore.setCurrent(zimbra); ZimbraStore.setCurrent(zimbra);
window.manager_config.dns.token = token; window.manager_config.dns.token = token;
window.manager_config.user_token = token;
return resolve(zimbra); return resolve(zimbra);
} }
...@@ -154,6 +156,9 @@ export function getAllCompanies() { ...@@ -154,6 +156,9 @@ export function getAllCompanies() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
return $.ajax({ return $.ajax({
url, url,
beforeSend: function(xhrObj) {
xhrObj.setRequestHeader("x-api-token", window.manager_config.user_token);
},
dataType: 'json', dataType: 'json',
success: function onSuccess(data) { success: function onSuccess(data) {
resolve(data); resolve(data);
...@@ -170,6 +175,9 @@ export function getCompany(id, success, error) { ...@@ -170,6 +175,9 @@ export function getCompany(id, success, error) {
return $.ajax({ return $.ajax({
url, url,
beforeSend: function(xhrObj) {
xhrObj.setRequestHeader("x-api-token", window.manager_config.user_token);
},
dataType: 'json', dataType: 'json',
success: function onSuccess(data) { success: function onSuccess(data) {
success(data); success(data);
...@@ -185,6 +193,9 @@ export function getInvoices(id, success, error) { ...@@ -185,6 +193,9 @@ export function getInvoices(id, success, error) {
return $.ajax({ return $.ajax({
url, url,
beforeSend: function(xhrObj) {
xhrObj.setRequestHeader("x-api-token", window.manager_config.user_token);
},
dataType: 'json', dataType: 'json',
success, success,
error: function onError(xhr, status, err) { error: function onError(xhr, status, err) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment