Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(private state: TransferState, @Inject(PLATFORM_ID) private platformId: any) {
let that = this;
ajax.inject({
sendRequest: function(...args) {
let key = makeStateKey(that.generateKey(args)),
cachedData = that.state.get(key, null as any);
if (isPlatformServer(that.platformId)) {
let result = this.callBase.apply(this, args);
result.always((data, status) => {
let dataForCache = {
data: data,
status: status
};
that.state.set(key, dataForCache as any);
});
return result;
} else {
if (cachedData) {