Ignore:
Timestamp:
11/09/21 17:07:49 (3 years ago)
Author:
Стојков Марко <mst@…>
Branches:
dev
Children:
fcc3080
Parents:
53bebc0 (diff), 6165fd0 (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.
Message:

Merged feature/delete-answer-and-answer-response into dev

File:
1 edited

Legend:

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

    r53bebc0 re071d30  
    1919  AnswerQuestion,
    2020  AnswerQuestionSuccess,
     21  DeleteAnswer,
     22  DeleteAnswerResponse,
     23  DeleteAnswerResponseSuccess,
     24  DeleteAnswerSuccess,
    2125  EditAnswerQuestion,
    2226  EditAnswerQuestionSuccess,
     
    236240    );
    237241  });
     242
     243  deleteResponseToAnswer$ = createEffect(() => {
     244    return this.actions$.pipe(
     245      ofType<DeleteAnswerResponse>(QuestionActionTypes.DeleteAnswerResponse),
     246      mergeMap((action) => {
     247        return this.api
     248          .delete<string>(`v1/questions/${action.questionUid}/answers/${action.answerUid}/answerresponses/${action.answerResponseUid}`)
     249          .pipe(
     250            tap((state) => this.notification.successNotification('success-delete-answer-response')),
     251            switchMap((state) => [new DeleteAnswerResponseSuccess(state, action.answerUid), new EffectFinishedWorking()]),
     252            catchError((err) => [new EffectFinishedWorkingError(err)])
     253          );
     254      })
     255    );
     256  });
     257
     258  deleteAnswer$ = createEffect(() => {
     259    return this.actions$.pipe(
     260      ofType<DeleteAnswer>(QuestionActionTypes.DeleteAnswer),
     261      mergeMap((action) => {
     262        return this.api.delete<string>(`v1/questions/${action.questionUid}/answers/${action.answerUid}`).pipe(
     263          tap((state) => this.notification.successNotification('success-delete-answer')),
     264          switchMap((state) => [new DeleteAnswerSuccess(state), new EffectFinishedWorking()]),
     265          catchError((err) => [new EffectFinishedWorkingError(err)])
     266        );
     267      })
     268    );
     269  });
    238270}
Note: See TracChangeset for help on using the changeset viewer.