Skip to content

Commit

Permalink
Merged in bugfix/remove-modal (pull request #310)
Browse files Browse the repository at this point in the history
SHIBUI Fixed issue with removing drafts
  • Loading branch information
rmathis committed Feb 28, 2019
2 parents 6c05a36 + 93b5a81 commit 44490e8
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 44490e8

Please sign in to comment.