title: Return a value from an action (NGXS) with http service
body: <p>Is there any other more clean way to return a value from an http service through an action (NGXS)? Or should we always update the "result" state just to be consulted on your return?</p>
  
  <p>The code below works, is very close to the documentation.
  However, it does not seem very clean to me.</p>
  
  <pre><code>export class DeleteAction {
    static readonly type = '[Test] Delete';
    constructor(public id: number) { }
  }
  </code></pre>
  
  <pre><code>@State&lt;TestStateModel&gt;({
    name: 'test',
    defaults: {
      result: null
    }
  })
  export class TestState {
  
    constructor(
      private testService: TestService) {
    }
  
    @Selector()
    static getResult(state: TestStateModel): NotificationResult {
      return state.result;
    }
  
    @Action(DeleteAction)
    public delete({ patchState }: StateContext&lt;TestStateModel&gt;, { id }: DeleteAction) {
      return this.testService
        .delete(id)
        .pipe(
          take(1),
          tap(result =&gt; {
            patchState({ result });
          })
        );
    }
  </code></pre>
  
  <pre><code>@Component({
    templateUrl: './test.component.html'
  })
  export class TestComponent {
  
      @Select(SubjectState.getResult) result$;
  
      private delete(id: number): void {
      this.isLoading = true;
      this.store.dispatch(new DeleteAction(id))
        .pipe(withLatestFrom(this.result$))
        .subscribe(([_, r]) =&gt; {
          const result = r as NotificationResult;
          if (result.isValid) {
            // ...
          } else {
            // ...
          }
          this.isLoading = false;
        });
    }
  }
  </code></pre>
  
  <pre><code>export interface NotificationResult {
    isValid: boolean;
    messages: NotificationMessage[];
  }
  </code></pre>
  
  <p>Since I will not use the "result" beyond calling the "Delete" method, it seems unnecessary to have to create a state just for this purpose.</p>
  
  <p>Is there any other more elegant way?</p>