1
0

Refactored Data Services

This commit is contained in:
Art Lowel
2017-02-22 12:03:22 +01:00
parent 9364c32ae2
commit bb5575cd27
18 changed files with 215 additions and 201 deletions

View File

@@ -0,0 +1,33 @@
import { Action } from "@ngrx/store";
import { type } from "../../shared/ngrx/type";
import { CacheableObject } from "./object-cache.reducer";
export const ObjectCacheActionTypes = {
ADD: type('dspace/core/cache/object/ADD'),
REMOVE: type('dspace/core/cache/object/REMOVE')
};
export class AddToObjectCacheAction implements Action {
type = ObjectCacheActionTypes.ADD;
payload: {
objectToCache: CacheableObject;
msToLive: number;
};
constructor(objectToCache: CacheableObject, msToLive: number) {
this.payload = { objectToCache, msToLive };
}
}
export class RemoveFromObjectCacheAction implements Action {
type = ObjectCacheActionTypes.REMOVE;
payload: string;
constructor(uuid: string) {
this.payload = uuid;
}
}
export type ObjectCacheAction
= AddToObjectCacheAction
| RemoveFromObjectCacheAction