Changes in src/Clients/Angular/finki-chattery/src/app/core/state/question-state/question.reducers.ts [7c3e6a8:a3b5f34]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Clients/Angular/finki-chattery/src/app/core/state/question-state/question.reducers.ts
r7c3e6a8 ra3b5f34 1 import { VoteType } from 'src/app/shared-app/models';2 1 import { QuestionAction, QuestionActionTypes } from './question.actions'; 3 2 import { initialState, QuestionState } from './question.state'; … … 26 25 searchQuestionsQuery: action.query 27 26 }; 28 case QuestionActionTypes.VoteAnswerSuccess: {29 if (state.question) {30 return {31 ...state,32 question: {33 ...state.question,34 answers: state.question.answers.map((x) => {35 if (x.uid === action.payload.answerUid) {36 let votesCountNew = x.votesCount;37 38 switch (action.payload.voteType) {39 case VoteType.Upvote:40 votesCountNew++;41 break;42 case VoteType.Downvote:43 votesCountNew--;44 break;45 }46 47 return {48 ...x,49 votesCount: votesCountNew50 };51 }52 53 return x;54 })55 }56 };57 }58 59 return {60 ...state61 };62 }63 27 case QuestionActionTypes.EffectStartedWorking: { 64 28 return {
Note:
See TracChangeset
for help on using the changeset viewer.