|
@@ -13,25 +13,9 @@ starter.factory('User', function ($resource, $q, $filter, cfg, formatFilter, glo
|
|
|
$httpProvider.interceptors.push(function ($q, cfg, global) {
|
|
|
return {
|
|
|
'request': function (config) {
|
|
|
- if (config.url != null && (global.refresh || global.debug)) { //if the call is not for an asset file
|
|
|
- config.url += (config.url.indexOf("?") === -1 ? "?" : "&") + "v=" + Date.now();
|
|
|
- if (global.refresh)
|
|
|
- global.refresh = false;
|
|
|
- }
|
|
|
-
|
|
|
- if (config.url.startsWith(cfg.api) || config.url.indexOf(global.api) == 0) {//分页时自带了请求路径
|
|
|
- if (config.url.startsWith(cfg.api)) config.url = global.api + config.url;
|
|
|
- console.log(angular.lowercase(config.method) + " url: " + config.url);
|
|
|
- if (global.user.token) {
|
|
|
- config.headers['authorization'] = 'Token ' + global.user.token;
|
|
|
- console.log(' authorization:' + config.headers['authorization']);
|
|
|
- }
|
|
|
- }
|
|
|
- config.timeout = 60000;
|
|
|
-
|
|
|
- if (config.url.indexOf("ext_erp") != -1) {//分页时自带了请求路径
|
|
|
+ if (config.url.indexOf("ext_erp") != -1) {
|
|
|
config.headers['cid'] = JSON.stringify({"linkid": global.user.compno, "langid": "TW", "phone": global.user.cellphone});
|
|
|
- config.headers['sn'] = global.sn;
|
|
|
+ // config.headers['sn'] = global.sn;
|
|
|
}
|
|
|
return config;
|
|
|
}
|