Skip to content

Commit

Permalink
SHIBUI Fixed issue with removing drafts
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Feb 28, 2019
1 parent 0b8b92b commit 93b5a81
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ui/src/app/metadata/resolver/effect/draft-collection.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,15 @@ export class DraftCollectionEffects {
removeDraft$ = this.actions$.pipe(
ofType<actions.RemoveDraftRequest>(DraftActionTypes.REMOVE_DRAFT),
map(getPayload),
switchMap(provider => this.draftService.find(provider.id, 'id').pipe(
switchMap(provider => {
let hasEntityId = !!provider.entityId;
let prop = hasEntityId ? 'entityId' : 'id';
let val = hasEntityId ? provider.entityId : provider.id;
return this.draftService.find(val, prop).pipe(
switchMap(selected => this.draftService.remove(selected)),
map(p => new actions.RemoveDraftSuccess(p))
)
)
);
})
);
@Effect()
removeDraftSuccessReload$ = this.actions$.pipe(
Expand Down

0 comments on commit 93b5a81

Please sign in to comment.