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
src/config
node_modules
/path.json
./path.json
.npminstall
ncp-debug.log
npm-debug.log
......
module.exports = {"main":{"js":"/531271bundle.js"}}
\ No newline at end of file
module.exports = {"main":{"js":"/516290bundle.js"}}
\ No newline at end of file
......@@ -47,6 +47,7 @@ function initZimbra() {
if (zimbra && token) {
window.manager_config.dns.token = token;
window.manager_config.user_token = token;
return resolve(zimbra);
} else if (token) {
zimbra = new ZimbraAdminApi({
......@@ -55,6 +56,7 @@ function initZimbra() {
zimbra.client.token = token;
ZimbraStore.setCurrent(zimbra);
window.manager_config.dns.token = token;
window.manager_config.user_token = token;
return resolve(zimbra);
}
......@@ -154,6 +156,9 @@ export function getAllCompanies() {
return new Promise((resolve, reject) => {
return $.ajax({
url,
beforeSend: function setApiToken(xhrObj) {
xhrObj.setRequestHeader('x-api-token', window.manager_config.user_token);
},
dataType: 'json',
success: function onSuccess(data) {
resolve(data);
......@@ -170,6 +175,9 @@ export function getCompany(id, success, error) {
return $.ajax({
url,
beforeSend: function setApiToken(xhrObj) {
xhrObj.setRequestHeader('x-api-token', window.manager_config.user_token);
},
dataType: 'json',
success: function onSuccess(data) {
success(data);
......@@ -185,6 +193,9 @@ export function getInvoices(id, success, error) {
return $.ajax({
url,
beforeSend: function setApiToken(xhrObj) {
xhrObj.setRequestHeader('x-api-token', window.manager_config.user_token);
},
dataType: 'json',
success,
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