Skip to content

Commit a2b2f69

Browse files
authored
Merge pull request #7 from Madhu5A3/editQuestionThunk
Edit question thunk
2 parents 1cafc2c + f200294 commit a2b2f69

4 files changed

Lines changed: 1 addition & 18 deletions

File tree

src/Reducer/RootReducer.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ const initialState = {
22
questions: []
33
};
44

5-
/*type: 'EDIT_QUESTIONS',
6-
payload_id: id,
7-
payload: data*/
8-
95
const RootReducer = (state = initialState, action) => {
106
switch (action.type) {
117
case 'ADD_QUESTIONS':

src/actionCreators/EditQuestion.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,3 @@ export const editQuestions = (id, data) => {
55
payload: data
66
}
77
}
8-
9-
10-
/*case 'EDIT_QUESTIONS':
11-
let newStateQuestion = action.payload;
12-
state.questions[action.id - 1].content = newStateQuestion;
13-
return {
14-
...state,
15-
questions: state.questions
16-
}*/

src/components/EditQuestion.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import React, { useState } from 'react';
22
import { useDispatch } from 'react-redux';
3-
// import { addQuestions } from '../actionCreators/AddQuestion';
3+
44
import { editQuestions } from '../actionCreators/EditQuestion';
55
import { formWrapper, inputWrapper } from '../css/GlobalCss';
66

77
const EditQuestion = (props) => {
88
const [enteredValue, setOutputValue] = useState('');
99
const dispatch = useDispatch();
1010
const { button_id, button_content } = props.location;
11-
// const questionList = useSelector(state => state.questions);
1211
const handleEdit = (enteredText) => {
1312
setOutputValue(enteredText.target.value);
1413
}

src/components/QuestionBox.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, { useEffect, useState } from 'react';
22
import AddThunkQuestion from '../actionCreators/AddThunkQuestion';
33
import { useSelector, useDispatch } from 'react-redux';
4-
// import { css } from 'emotion';
54
import { questionWrapper, containerWrapper, buttonWrapper } from '../css/GlobalCss';
65

76
const QuestionBox = () => {
@@ -22,8 +21,6 @@ const QuestionBox = () => {
2221
});
2322

2423
let displayRandomQuestion = questionList[Math.floor(Math.random() * questionList.length)];
25-
26-
//return displayRandomQuestion;
2724
setQuestions(displayRandomQuestion);
2825
}
2926

0 commit comments

Comments
 (0)