michael-watts
7/31/2019 - 7:27 AM

test

import { Action } from '@ngrx/store';
import { HttpErrorResponse } from '@angular/common/http';

export enum RateUsActionTypes {
  SET_FEEDBACK = '[Set Feedback Message Effect API] Set the feedback message text',
  SET_FEEDBACK_SUCCESS = '[Set Feedback Message Effect API Success] Set the feedback message text success',
  SET_FEEDBACK_ERROR = '[Set Feedback Message Effect API Error] Set the feedback message error',

  SET_RATING = '[Set Star Rating Effect API] Set the selected star rating',
  SET_RATING_SUCCESS = '[Set Star Rating Effect API Success] Set the selected star rating success',
  SET_RATING_ERROR = '[Set Star Rating Effect API Error] Set the selected star rating error',

  SUBMIT_FORM = '[Submit Rating Form Effect API] Submit the rating form',
  SUBMIT_FORM_SUCCESS = '[Submit Rating Form Effect API Success] Submit the rating form success',
  SUBMIT_FORM_ERROR = '[Submit Rating Form Effect API Error] Submit the rating form error',
}

export class SetFeedback implements Action {
  readonly type = RateUsActionTypes.SET_FEEDBACK;
  constructor(public payload: string) {
  }
}

export class SetFeedbackSuccess implements Action {
  readonly type = RateUsActionTypes.SET_FEEDBACK_SUCCESS;
}

export class SetFeedbackError implements Action {
  readonly type = RateUsActionTypes.SET_FEEDBACK_ERROR;
  constructor(public payload: { error: HttpErrorResponse }) {
  }
}

export class SetRating implements Action {
  readonly type = RateUsActionTypes.SET_RATING;
  constructor(public payload: number) {
  }
}

export class SetRatingSuccess implements Action {
  readonly type = RateUsActionTypes.SET_RATING_SUCCESS;
}

export class SetRatingError implements Action {
  readonly type = RateUsActionTypes.SET_RATING_ERROR;
  constructor(public payload: { error: HttpErrorResponse }) {
  }
}

export class SubmitRatingForm implements Action {
  readonly type = RateUsActionTypes.SUBMIT_FORM;
  constructor(public payload: object) {
  }
}

export class SubmitRatingFormSuccess implements Action {
  readonly type = RateUsActionTypes.SUBMIT_FORM_SUCCESS;
}

export class SubmitRatingFormError implements Action {
  readonly type = RateUsActionTypes.SUBMIT_FORM_ERROR;
  constructor(public payload: { error: HttpErrorResponse }) {
  }
}

export type RateUsActions =
  | SetFeedback
  | SetFeedbackError
  | SetFeedbackSuccess
  | SetRating
  | SetRatingError
  | SetRatingSuccess
  | SubmitRatingForm
  | SubmitRatingFormError
  | SubmitRatingFormSuccess;