Changeset 74ad056 for src/Clients/Angular/finki-chattery/src/app/core/state/question-state/question.effects.ts
- Timestamp:
- 11/09/21 14:45:35 (3 years ago)
- Branches:
- dev
- Children:
- 53bebc0, 9df3069
- Parents:
- 7e7cc4c (diff), 48f727d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Clients/Angular/finki-chattery/src/app/core/state/question-state/question.effects.ts
r7e7cc4c r74ad056 8 8 import { NotificationService } from '../../services/notification.service'; 9 9 import { QuestionFacadeService } from '../question-facade.service'; 10 import { RespondToAnswerRequest, VoteAnswerRequest } from './question-state-request.models';10 import { AnswerQuestionRequest, RespondToAnswerRequest, VoteAnswerRequest } from './question-state-request.models'; 11 11 import { 12 AnswerQuestionStateResponse, 12 13 AnswerResponseQuestionStateResponse, 13 14 PreviewQuestionResponse, … … 16 17 } from './question-state-response.models'; 17 18 import { 19 AnswerQuestion, 20 AnswerQuestionSuccess, 18 21 EffectFinishedWorking, 19 22 EffectFinishedWorkingError, … … 165 168 ); 166 169 }); 170 171 answerQuestion$ = createEffect(() => { 172 return this.actions$.pipe( 173 ofType<AnswerQuestion>(QuestionActionTypes.AnswerQuestion), 174 mergeMap((action) => { 175 return this.api 176 .post<AnswerQuestionStateResponse>(`v1/questions/${action.questionUid}/answers`, new AnswerQuestionRequest(action.text)) 177 .pipe( 178 tap((state) => this.notification.successNotification('success-answer')), 179 switchMap((state) => [ 180 new AnswerQuestionSuccess(QuestionMapper.ToAnswerQuestionStateViewModel(state)), 181 new EffectFinishedWorking() 182 ]), 183 catchError((err) => [new EffectFinishedWorkingError(err)]) 184 ); 185 }) 186 ); 187 }); 167 188 }
Note:
See TracChangeset
for help on using the changeset viewer.