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