mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-11 20:13:07 +00:00
130: more core tests
This commit is contained in:
24
src/app/core/cache/object-cache.effects.ts
vendored
Normal file
24
src/app/core/cache/object-cache.effects.ts
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Actions, Effect } from '@ngrx/effects';
|
||||
|
||||
import { StoreActionTypes } from '../../store.actions';
|
||||
import { ResetObjectCacheTimestampsAction } from './object-cache.actions';
|
||||
|
||||
@Injectable()
|
||||
export class ObjectCacheEffects {
|
||||
|
||||
/**
|
||||
* When the store is rehydrated in the browser, set all cache
|
||||
* timestamps to 'now', because the time zone of the server can
|
||||
* differ from the client.
|
||||
*
|
||||
* This assumes that the server cached everything a negligible
|
||||
* time ago, and will likely need to be revisited later
|
||||
*/
|
||||
@Effect() fixTimestampsOnRehydrate = this.actions$
|
||||
.ofType(StoreActionTypes.REHYDRATE)
|
||||
.map(() => new ResetObjectCacheTimestampsAction(new Date().getTime()));
|
||||
|
||||
constructor(private actions$: Actions) { }
|
||||
|
||||
}
|
Reference in New Issue
Block a user