Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Clients/Angular/finki-chattery/src/app/core/state/question-state/question.effects.ts

    r7c3e6a8 r59d860c  
    77import { BaseApiService } from 'src/app/shared-app/services/base-api.service';
    88import { QuestionFacadeService } from '../question-facade.service';
    9 import { VoteAnswerRequest } from './question-state-request.models';
    10 import { PreviewQuestionResponse, QuestionStateResponse, VoteAnswerResponse } from './question-state-response.models';
     9import { PreviewQuestionResponse, QuestionStateResponse } from './question-state.models';
    1110import {
    1211  EffectFinishedWorking,
     
    2019  GetSearchQuestions,
    2120  GetSearchQuestionsSuccess,
    22   QuestionActionTypes,
    23   VoteAnswer,
    24   VoteAnswerSuccess
     21  QuestionActionTypes
    2522} from './question.actions';
    2623import { QuestionMapper } from './question.mapper';
     
    106103    );
    107104  });
    108 
    109   voteAnswer$ = createEffect(() => {
    110     return this.actions$.pipe(
    111       ofType<VoteAnswer>(QuestionActionTypes.VoteAnswer),
    112       mergeMap((action) => {
    113         const body = new VoteAnswerRequest(action.voteType);
    114         return this.api.post<VoteAnswerResponse>(`v1/questions/${action.questionUid}/answers/${action.answerUid}/votes`, body).pipe(
    115           switchMap((state) => [new VoteAnswerSuccess(QuestionMapper.ToVoteAnswerViewModel(state)), new EffectFinishedWorking()]),
    116           catchError((err) => [new EffectFinishedWorkingError(err)])
    117         );
    118       })
    119     );
    120   });
    121105}
Note: See TracChangeset for help on using the changeset viewer.