Commit 07e7622d authored by Patricio Bruna's avatar Patricio Bruna

Merge pull request #95 from ZBoxApp/companies_token_87

Companies token 87
parents ec3c99ca a14c7432
...@@ -5,6 +5,7 @@ dist ...@@ -5,6 +5,7 @@ dist
src/config src/config
node_modules node_modules
/path.json /path.json
./path.json
.npminstall .npminstall
ncp-debug.log ncp-debug.log
npm-debug.log npm-debug.log
......
module.exports = {"main":{"js":"/531271bundle.js"}} module.exports = {"main":{"js":"/516290bundle.js"}}
\ No newline at end of file \ No newline at end of file
...@@ -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 setApiToken(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 setApiToken(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 setApiToken(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