Changes in src/Clients/Angular/finki-chattery/src/app/core/state/question-state/question.effects.ts [59d860c:7c3e6a8]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Clients/Angular/finki-chattery/src/app/core/state/question-state/question.effects.ts
r59d860c r7c3e6a8 7 7 import { BaseApiService } from 'src/app/shared-app/services/base-api.service'; 8 8 import { QuestionFacadeService } from '../question-facade.service'; 9 import { PreviewQuestionResponse, QuestionStateResponse } from './question-state.models'; 9 import { VoteAnswerRequest } from './question-state-request.models'; 10 import { PreviewQuestionResponse, QuestionStateResponse, VoteAnswerResponse } from './question-state-response.models'; 10 11 import { 11 12 EffectFinishedWorking, … … 19 20 GetSearchQuestions, 20 21 GetSearchQuestionsSuccess, 21 QuestionActionTypes 22 QuestionActionTypes, 23 VoteAnswer, 24 VoteAnswerSuccess 22 25 } from './question.actions'; 23 26 import { QuestionMapper } from './question.mapper'; … … 103 106 ); 104 107 }); 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 }); 105 121 }
Note:
See TracChangeset
for help on using the changeset viewer.