1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-19 05:19:39 +02:00

feat(cache): introduce cache option [EE-6293] (#10672)

Co-authored-by: testa113 <testa113>
This commit is contained in:
Ali 2023-11-22 14:21:07 +13:00 committed by GitHub
parent 57ed6ae6a6
commit 4096bb562d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
71 changed files with 421 additions and 49 deletions

View file

@ -2,6 +2,7 @@ import { Terminal } from 'xterm';
import * as fit from 'xterm/lib/addons/fit/fit';
import { csrfInterceptor, csrfTokenReaderInterceptorAngular } from './portainer/services/csrf';
import { agentInterceptor } from './portainer/services/axios';
import { dispatchCacheRefreshEventIfNeeded } from './portainer/services/http-request.helper';
/* @ngInject */
export function configApp($urlRouterProvider, $httpProvider, localStorageServiceProvider, $uibTooltipProvider, $compileProvider, cfpLoadingBarProvider) {
@ -9,6 +10,14 @@ export function configApp($urlRouterProvider, $httpProvider, localStorageService
$compileProvider.debugInfoEnabled(false);
}
// ask to clear cache on mutation
$httpProvider.interceptors.push(() => ({
request: (reqConfig) => {
dispatchCacheRefreshEventIfNeeded(reqConfig);
return reqConfig;
},
}));
localStorageServiceProvider.setPrefix('portainer');
$httpProvider.defaults.headers.post['Content-Type'] = 'application/json';