| 1 |
const Question = { |
| 2 |
|
| 3 |
UPDATE_STATUS: function( state, status ) { |
| 4 |
state.status = status; |
| 5 |
}, |
| 6 |
|
| 7 |
UPDATE_AUTO_DRAFT_STATUS: function( state, status ) { |
| 8 |
state.auto_draft = status; |
| 9 |
}, |
| 10 |
|
| 11 |
CHANGE_QUESTION_TYPE: function( state, question ) { |
| 12 |
state.answers = question.answers; |
| 13 |
state.type = question.type; |
| 14 |
}, |
| 15 |
|
| 16 |
SET_ANSWERS: function( state, answers ) { |
| 17 |
state.answers = answers; |
| 18 |
}, |
| 19 |
|
| 20 |
DELETE_ANSWER: function( state, id ) { |
| 21 |
for ( var i = 0, n = state.answers.length; i < n; i++ ) { |
| 22 |
if ( state.answers[i].question_answer_id == id ) { |
| 23 |
state.answers[i].question_answer_id = LP.uniqueId(); |
| 24 |
break; |
| 25 |
} |
| 26 |
} |
| 27 |
}, |
| 28 |
|
| 29 |
ADD_NEW_ANSWER: function( state, answer ) { |
| 30 |
state.answers.push( answer ); |
| 31 |
}, |
| 32 |
|
| 33 |
UPDATE_ANSWERS: function( state, answers ) { |
| 34 |
state.answers = answers; |
| 35 |
}, |
| 36 |
|
| 37 |
INCREASE_NUMBER_REQUEST: function( state ) { |
| 38 |
state.countCurrentRequest++; |
| 39 |
}, |
| 40 |
|
| 41 |
DECREASE_NUMBER_REQUEST: function( state ) { |
| 42 |
state.countCurrentRequest--; |
| 43 |
}, |
| 44 |
}; |
| 45 |
|
| 46 |
export default Question; |
| 47 |
|