mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +00:00
fix circular dependency issues relating to request models
This commit is contained in:
@@ -8,7 +8,6 @@ import { cloneDeep } from 'lodash';
|
||||
import { hasValue, isEmpty, isNotEmpty, hasNoValue } from '../../shared/empty.util';
|
||||
import { ObjectCacheEntry } from '../cache/object-cache.reducer';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { IndexState, MetaIndexState } from '../index/index.reducer';
|
||||
import { requestIndexSelector, getUrlWithoutEmbedParams } from '../index/index.selectors';
|
||||
import { UUIDService } from '../shared/uuid.service';
|
||||
@@ -17,12 +16,15 @@ import {
|
||||
RequestExecuteAction,
|
||||
RequestStaleAction
|
||||
} from './request.actions';
|
||||
import { GetRequest, RestRequest } from './request.models';
|
||||
import { RequestEntry, RequestState} from './request.reducer';
|
||||
import { GetRequest} from './request.models';
|
||||
import { CommitSSBAction } from '../cache/server-sync-buffer.actions';
|
||||
import { RestRequestMethod } from './rest-request-method';
|
||||
import { coreSelector } from '../core.selectors';
|
||||
import { isLoading, isStale } from './request-entry-state.model';
|
||||
import { RestRequest } from './rest-request.model';
|
||||
import { CoreState } from '../core-state.model';
|
||||
import { RequestState } from './request-state.model';
|
||||
import { RequestEntry } from './request-entry.model';
|
||||
|
||||
/**
|
||||
* The base selector function to select the request state in the store
|
||||
@@ -145,7 +147,7 @@ export class RequestService {
|
||||
/**
|
||||
* Check if a GET request is currently pending
|
||||
*/
|
||||
isPending(request: GetRequest): boolean {
|
||||
isPending(request: RestRequest): boolean {
|
||||
// If the request is not a GET request, it will never be considered pending, because you may
|
||||
// want to execute the exact same e.g. POST multiple times
|
||||
if (request.method !== RestRequestMethod.GET) {
|
||||
@@ -242,7 +244,7 @@ export class RequestService {
|
||||
if (this.shouldDispatchRequest(request, useCachedVersionIfAvailable)) {
|
||||
this.dispatchRequest(request);
|
||||
if (request.method === RestRequestMethod.GET) {
|
||||
this.trackRequestsOnTheirWayToTheStore(request);
|
||||
this.trackRequestsOnTheirWayToTheStore(request as GetRequest);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
@@ -315,7 +317,7 @@ export class RequestService {
|
||||
* @param {boolean} useCachedVersionIfAvailable Whether or not to allow the use of a cached version
|
||||
* @returns {boolean} True if the request is cached or still pending
|
||||
*/
|
||||
public shouldDispatchRequest(request: GetRequest, useCachedVersionIfAvailable: boolean): boolean {
|
||||
public shouldDispatchRequest(request: RestRequest, useCachedVersionIfAvailable: boolean): boolean {
|
||||
// if it's not a GET request
|
||||
if (request.method !== RestRequestMethod.GET) {
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user