From 20c7afce06532c033552f69e35fdb183c2aac091 Mon Sep 17 00:00:00 2001 From: Corrado Lombardi Date: Thu, 22 Oct 2020 15:46:29 +0200 Subject: [PATCH] [CSTPER-66] utility functions to create remote data object without content --- src/app/shared/remote-data.utils.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/app/shared/remote-data.utils.ts b/src/app/shared/remote-data.utils.ts index ce278e0229..580b68673b 100644 --- a/src/app/shared/remote-data.utils.ts +++ b/src/app/shared/remote-data.utils.ts @@ -69,3 +69,24 @@ export function createPendingRemoteDataObject(object?: T): RemoteData { export function createPendingRemoteDataObject$(object?: T): Observable> { return observableOf(createPendingRemoteDataObject(object)); } + +/** + * Method to create a remote data object with no content + */ +export function createNoContentRemoteDataObject(): RemoteData { + return new RemoteData( + true, + true, + true, + null, + null, + 204 + ); +} + +/** + * Method to create a remote data object that has succeeded with no content, wrapped in an observable + */ +export function createNoContentRemoteDataObject$(): Observable> { + return observableOf(createNoContentRemoteDataObject()); +}