Showing
1 changed file
with
12 additions
and
6 deletions
| ... | ... | @@ -587,12 +587,18 @@ App.clearServiceWorker = function(success) |
| 587 | 587 | * |
| 588 | 588 | * Optional callback is called with the app instance. |
| 589 | 589 | */ |
| 590 | +let defHttp; | |
| 590 | 591 | App.main = function(callback, createUi) |
| 591 | 592 | { |
| 593 | + | |
| 592 | 594 | Editor.configurationId = urlParams.configurationId; |
| 593 | 595 | const localStorageInfo = localStorage.getItem("UNDEFINED__DEVELOPMENT__2.7.1__COMMON__LOCAL__KEY__"); |
| 594 | - DefHttp.token = JSON.parse(localStorageInfo).value.JWT_TOKEN.value; | |
| 595 | - | |
| 596 | + // 应用启动入口时创建一个axios实例,供全局使用 | |
| 597 | + defHttp = createAxios({ | |
| 598 | + timeout:10*1000, | |
| 599 | + baseURL:'/api', | |
| 600 | + token: JSON.parse(localStorageInfo).value.JWT_TOKEN.value | |
| 601 | + }) | |
| 596 | 602 | // Logs uncaught errors |
| 597 | 603 | window.onerror = function(message, url, linenumber, colno, err) |
| 598 | 604 | { |
| ... | ... | @@ -4983,11 +4989,11 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) { |
| 4983 | 4989 | sameWindow = true; |
| 4984 | 4990 | } |
| 4985 | 4991 | //调用API,获取保存的内容 |
| 4986 | - DefHttp().get('/yt/configuration/center/getConfigurationInfo/'+Editor.configurationId) | |
| 4992 | + defHttp.get('/yt/configuration/center/getConfigurationInfo/'+Editor.configurationId) | |
| 4987 | 4993 | .then(function (response) { |
| 4988 | - Editor.configurationName = response.data.configurationName + ".drawio"; | |
| 4989 | - if(response.data.configurationContentList.length > 0){ | |
| 4990 | - response.data.configurationContentList.forEach((item)=>{ | |
| 4994 | + Editor.configurationName = response.configurationName + ".drawio"; | |
| 4995 | + if(response.configurationContentList.length > 0){ | |
| 4996 | + response.configurationContentList.forEach((item)=>{ | |
| 4991 | 4997 | Editor.configurationContentId = item.id; |
| 4992 | 4998 | if(item.content){ |
| 4993 | 4999 | Editor.defaultContent = item.content; | ... | ... |