sveta 5 年 前
コミット
0f33146481

+ 158 - 3
package-lock.json

@@ -962,6 +962,29 @@
       "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz",
       "integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw=="
     },
+    "@react-bootstrap/react-popper": {
+      "version": "1.2.1",
+      "resolved": "https://registry.npmjs.org/@react-bootstrap/react-popper/-/react-popper-1.2.1.tgz",
+      "integrity": "sha512-4l3q7LcZEhrSkI4d3Ie3g4CdrXqqTexXX4PFT45CB0z5z2JUbaxgRwKNq7r5j2bLdVpZm+uvUGqxJw8d9vgbJQ==",
+      "requires": {
+        "babel-runtime": "6.x.x",
+        "create-react-context": "^0.2.1",
+        "popper.js": "^1.14.4",
+        "prop-types": "^15.6.1",
+        "typed-styles": "^0.0.5",
+        "warning": "^3.0.0"
+      },
+      "dependencies": {
+        "warning": {
+          "version": "3.0.0",
+          "resolved": "https://registry.npmjs.org/warning/-/warning-3.0.0.tgz",
+          "integrity": "sha1-MuU3fLVy3kqwR1O9+IIcAe1gW3w=",
+          "requires": {
+            "loose-envify": "^1.0.0"
+          }
+        }
+      }
+    },
     "@redux-saga/core": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/@redux-saga/core/-/core-1.0.0.tgz",
@@ -2666,9 +2689,9 @@
       "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24="
     },
     "bootstrap": {
-      "version": "4.2.1",
-      "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.2.1.tgz",
-      "integrity": "sha512-tt/7vIv3Gm2mnd/WeDx36nfGGHleil0Wg8IeB7eMrVkY0fZ5iTaBisSh8oNANc2IBsCc6vCgCNTIM/IEN0+50Q=="
+      "version": "4.3.0",
+      "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.3.0.tgz",
+      "integrity": "sha512-M0vqY0Z6UDweV2nLFl5dXcb+GIo53EBCGMMVxCGH5vJxl/jsr+HkULBMd4kn9rdpdBZwd3BduCgMOYOwJybo4Q=="
     },
     "brace-expansion": {
       "version": "1.1.11",
@@ -8892,6 +8915,11 @@
       "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-2.2.0.tgz",
       "integrity": "sha1-fYa9VmefWM5qhHBKZX3TkruoGnk="
     },
+    "keycode": {
+      "version": "2.2.0",
+      "resolved": "https://registry.npmjs.org/keycode/-/keycode-2.2.0.tgz",
+      "integrity": "sha1-PQr1bce4uOXLqNCpfxByBO7CKwQ="
+    },
     "killable": {
       "version": "1.0.1",
       "resolved": "https://registry.npmjs.org/killable/-/killable-1.0.1.tgz",
@@ -13899,6 +13927,25 @@
         "object-assign": "^4.1.1"
       }
     },
+    "prop-types-extra": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/prop-types-extra/-/prop-types-extra-1.1.0.tgz",
+      "integrity": "sha512-QFyuDxvMipmIVKD2TwxLVPzMnO4e5oOf1vr3tJIomL8E7d0lr6phTHd5nkPhFIzTD1idBLLEPeylL9g+rrTzRg==",
+      "requires": {
+        "react-is": "^16.3.2",
+        "warning": "^3.0.0"
+      },
+      "dependencies": {
+        "warning": {
+          "version": "3.0.0",
+          "resolved": "https://registry.npmjs.org/warning/-/warning-3.0.0.tgz",
+          "integrity": "sha1-MuU3fLVy3kqwR1O9+IIcAe1gW3w=",
+          "requires": {
+            "loose-envify": "^1.0.0"
+          }
+        }
+      }
+    },
     "proxy-addr": {
       "version": "2.0.4",
       "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz",
@@ -14637,6 +14684,48 @@
         }
       }
     },
+    "react-bootstrap": {
+      "version": "1.0.0-beta.5",
+      "resolved": "https://registry.npmjs.org/react-bootstrap/-/react-bootstrap-1.0.0-beta.5.tgz",
+      "integrity": "sha512-Osm0OtTbYwfsT1rpu88ESWuAHZxfaHFNKFiW8w3w+6YY9/bLEPHbGRZA6W21fg5yvcuKN9hJKT857TTHgY7SoQ==",
+      "requires": {
+        "@babel/runtime": "^7.2.0",
+        "@react-bootstrap/react-popper": "1.2.1",
+        "classnames": "^2.2.6",
+        "dom-helpers": "^3.4.0",
+        "invariant": "^2.2.3",
+        "keycode": "^2.1.2",
+        "popper.js": "^1.14.6",
+        "prop-types": "^15.6.2",
+        "prop-types-extra": "^1.1.0",
+        "react-context-toolbox": "^2.0.2",
+        "react-overlays": "^1.0.0",
+        "react-prop-types": "^0.4.0",
+        "react-transition-group": "^2.5.1",
+        "uncontrollable": "^6.0.0",
+        "warning": "^4.0.1"
+      },
+      "dependencies": {
+        "@babel/runtime": {
+          "version": "7.3.1",
+          "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.3.1.tgz",
+          "integrity": "sha512-7jGW8ppV0ant637pIqAcFfQDDH1orEPGJb8aXfUozuCU3QqX7rX4DA8iwrbPrR1hcH0FTTHz47yQnk+bl5xHQA==",
+          "requires": {
+            "regenerator-runtime": "^0.12.0"
+          }
+        },
+        "regenerator-runtime": {
+          "version": "0.12.1",
+          "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz",
+          "integrity": "sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg=="
+        }
+      }
+    },
+    "react-context-toolbox": {
+      "version": "2.0.2",
+      "resolved": "https://registry.npmjs.org/react-context-toolbox/-/react-context-toolbox-2.0.2.tgz",
+      "integrity": "sha512-tY4j0imkYC3n5ZlYSgFkaw7fmlCp3IoQQ6DxpqeNHzcD0hf+6V+/HeJxviLUZ1Rv1Yn3N3xyO2EhkkZwHn0m1A=="
+    },
     "react-dev-utils": {
       "version": "7.0.1",
       "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-7.0.1.tgz",
@@ -14807,6 +14896,59 @@
       "resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz",
       "integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA=="
     },
+    "react-overlays": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/react-overlays/-/react-overlays-1.1.1.tgz",
+      "integrity": "sha512-acL+HwhD1I/AY1Hz7qWQvnBaXEZt5K+huZ2AySdBtJORKNSxnLrd6j2FL3KOEM3rQQWuzAubCYiinlrm2XxXFA==",
+      "requires": {
+        "classnames": "^2.2.6",
+        "dom-helpers": "^3.4.0",
+        "prop-types": "^15.6.2",
+        "prop-types-extra": "^1.1.0",
+        "react-context-toolbox": "^2.0.2",
+        "react-popper": "^1.3.2",
+        "uncontrollable": "^6.0.0",
+        "warning": "^4.0.2"
+      }
+    },
+    "react-popper": {
+      "version": "1.3.3",
+      "resolved": "https://registry.npmjs.org/react-popper/-/react-popper-1.3.3.tgz",
+      "integrity": "sha512-ynMZBPkXONPc5K4P5yFWgZx5JGAUIP3pGGLNs58cfAPgK67olx7fmLp+AdpZ0+GoQ+ieFDa/z4cdV6u7sioH6w==",
+      "requires": {
+        "@babel/runtime": "^7.1.2",
+        "create-react-context": "<=0.2.2",
+        "popper.js": "^1.14.4",
+        "prop-types": "^15.6.1",
+        "typed-styles": "^0.0.7",
+        "warning": "^4.0.2"
+      },
+      "dependencies": {
+        "typed-styles": {
+          "version": "0.0.7",
+          "resolved": "https://registry.npmjs.org/typed-styles/-/typed-styles-0.0.7.tgz",
+          "integrity": "sha512-pzP0PWoZUhsECYjABgCGQlRGL1n7tOHsgwYv3oIiEpJwGhFTuty/YNeduxQYzXXa3Ge5BdT6sHYIQYpl4uJ+5Q=="
+        }
+      }
+    },
+    "react-prop-types": {
+      "version": "0.4.0",
+      "resolved": "https://registry.npmjs.org/react-prop-types/-/react-prop-types-0.4.0.tgz",
+      "integrity": "sha1-+ZsL+0AGkpya8gUefBQUpcdbk9A=",
+      "requires": {
+        "warning": "^3.0.0"
+      },
+      "dependencies": {
+        "warning": {
+          "version": "3.0.0",
+          "resolved": "https://registry.npmjs.org/warning/-/warning-3.0.0.tgz",
+          "integrity": "sha1-MuU3fLVy3kqwR1O9+IIcAe1gW3w=",
+          "requires": {
+            "loose-envify": "^1.0.0"
+          }
+        }
+      }
+    },
     "react-redux": {
       "version": "6.0.0",
       "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-6.0.0.tgz",
@@ -17495,6 +17637,11 @@
         "mime-types": "~2.1.18"
       }
     },
+    "typed-styles": {
+      "version": "0.0.5",
+      "resolved": "https://registry.npmjs.org/typed-styles/-/typed-styles-0.0.5.tgz",
+      "integrity": "sha512-ht+rEe5UsdEBAa3gr64+QjUOqjOLJfWLvl5HZR5Ev9uo/OnD3p43wPeFSB1hNFc13GXQF/JU1Bn0YHLUqBRIlw=="
+    },
     "typedarray": {
       "version": "0.0.6",
       "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
@@ -17651,6 +17798,14 @@
         }
       }
     },
+    "uncontrollable": {
+      "version": "6.0.0",
+      "resolved": "https://registry.npmjs.org/uncontrollable/-/uncontrollable-6.0.0.tgz",
+      "integrity": "sha512-gmy2ESW40LGbijSbW5piBGiPv55IgyDbjQcMr7LkDR5icpw/06UgMqULAGDBAcFn2a9d/SRPgcb3oo8hdEUfIw==",
+      "requires": {
+        "invariant": "^2.2.4"
+      }
+    },
     "unicode-canonical-property-names-ecmascript": {
       "version": "1.0.4",
       "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz",

+ 2 - 1
package.json

@@ -5,12 +5,13 @@
   "dependencies": {
     "antd": "^3.13.2",
     "axios": "^0.18.0",
-    "bootstrap": "^4.2.1",
+    "bootstrap": "^4.3.0",
     "jquery": "^3.3.1",
     "jwt-decode": "^2.2.0",
     "node-sass": "^4.11.0",
     "popper.js": "^1.14.6",
     "react": "^16.6.3",
+    "react-bootstrap": "^1.0.0-beta.5",
     "react-dom": "^16.6.3",
     "react-redux": "^6.0.0",
     "react-router": "^4.3.1",

+ 1 - 1
src/actions/admin/changeTest/changeTest.js

@@ -15,7 +15,7 @@ export const changeQuestionSuccess = payload => ({
     type: actionTypes.CHANGE_QUESTIONS_REQUEST_SUCCESS,
     payload
 });
-export const createAnswersSuccess = payload => ({
+export const changeAnswersSuccess = payload => ({
     type: actionTypes.CHANGE_ANSVERS_REQUEST_SUCCESS,
     payload
 });

+ 18 - 0
src/actions/admin/changeTest/deleteAnswer.js

@@ -0,0 +1,18 @@
+import * as actionTypes from '../../../constants/admin';
+
+export const deleteAnswerRequest = payload => {
+    console.log(payload)
+    return{
+    type: actionTypes.DELETE_ANSWER_REQUEST,
+    payload
+};
+}
+export const deleteAnswerSuccess = payload => ({
+    type: actionTypes.DELETE_ANSWER_REQUEST_SUCCESS,
+    payload
+});
+
+export const deleteAnswerFailure = error => ({
+    type: actionTypes.DELETE_ANSWER_REQUEST_FAILURE,
+    error
+});

+ 18 - 0
src/actions/user/test/getTopics.js

@@ -0,0 +1,18 @@
+import * as actionTypes from '../../../constants/user';
+
+
+export const getTopicTestRequest = payload => {
+    console.log(payload)
+    return{
+    type: actionTypes.GET_TOPIC_TEST_REQUEST,
+    payload
+};
+}
+export const getTopicTestSuccess = payload => ({
+    type: actionTypes.GET_TOPIC_TEST_REQUEST_SUCCESS,
+    payload
+});
+export const getTopicTestFailure = error => ({
+    type: actionTypes.GET_TOPIC_TEST_REQUEST_FAILURE,
+    error
+});

+ 18 - 0
src/actions/user/test/testStart.js

@@ -0,0 +1,18 @@
+import * as actionTypes from '../../../constants/user';
+
+
+export const startTestRequest = payload => {
+    console.log(payload)
+    return{
+    type: actionTypes.START_TEST_REQUEST,
+    payload
+};
+}
+export const startTestSuccess = payload => ({
+    type: actionTypes.START_TEST_REQUEST_SUCCESS,
+    payload
+});
+export const startTestFailure = error => ({
+    type: actionTypes.START_TEST_REQUEST_FAILURE,
+    error
+});

+ 5 - 1
src/components/admin/addDeleteCategory/GetCategory.js

@@ -104,7 +104,9 @@ class GetCategory extends React.Component {
 
         return (
             <div>
-                <div className="container w-100 h-auto  bg-stone  bg-mist-border">
+            <div className=" padding profile-page  d-flex flex-row font-ci">
+                <div className="w-100 m-5 bg-gradient border rounded">
+                    <div className=" m-5 text-center  text-white font-ci font-ci-bold ">
                     {
                         massCategory !== null
                             ?
@@ -140,6 +142,8 @@ class GetCategory extends React.Component {
                         :
                         null
                 }
+                </div>
+                </div>
             </div>
         )
     }

+ 36 - 20
src/components/admin/getChangeDeleteTest/GetTopic.js

@@ -27,27 +27,43 @@ class GetTest extends React.Component {
     //     console.log(deleteTopic)
 
     // }
-    // componentWillUpdate(nextState, nextProps) {
-    //     const { deleteTopic: { isFetching }, topicElement: { id } } = nextState;
-    //     const { arrayTopic } = nextProps;
-    //     console.log(isFetching, "nextState---------", nextState, "nextProps_________", nextProps)
-    //     if (!isFetching) {
-    //         for (let key in arrayTopic) {
-    //             if (arrayTopic[key]._id == id) {
-    //                 this.setState(prevState => {
-    //                     console.log("-------TRUE--------")
-    //                     const array = prevState.arrayTopic.slice()
-    //                     array.splice(key, 1)
-    //                     return {
-    //                         arrayTopic: array
-    //                     }
-    //                 })
-    //                 break;
-    //             }
-    //         }
+    componentWillUpdate(nextState, nextProps) {
+        const { newTopic,deleteTopic, topicId } = nextState;
+        const { arrayTopic:{topic} } = nextProps;
+        console.log( "nextState---------", nextState, "nextProps_________", nextProps)
+        if (newTopic.data !==null) {
+            for (let key in topic) {
+                if (topic[key]._id == newTopic.data._id) {
+                    this.setState(prevState => {
+                        console.log("-------TRUE--------")
+                        const array = prevState.arrayTopic.topic.slice()
+                        array.splice(key, 1,newTopic.data)
+                        return {
+                            arrayTopic: array
+                        }
+                    })
+                    break;
+                }
+            }
 
-    //     }
-    // }
+        }
+        if(!deleteTopic.isFetching){
+            for (let key in topic) {
+                if (topic[key]._id == topicId) {
+                    this.setState(prevState => {
+                        console.log("-------TRUE--------", topic[key]._id ===topicId)
+                        const array = prevState.arrayTopic.topic.slice()
+                        array.splice(key, 1)
+                        console.log(array)
+                        return {
+                            arrayTopic: array
+                        }
+                    })
+                    break;
+                }
+            }
+        }
+    }
 
 
     render() {

+ 139 - 46
src/components/admin/getChangeDeleteTest/OpenModal.js

@@ -1,66 +1,150 @@
 import React, { Component } from "react";
-import { Modal } from "antd";
+import { Modal } from "react-bootstrap";
+import { Header } from "react-bootstrap/ModalHeader";
+import { Button } from "react-bootstrap"
 import { Field, reduxForm } from 'redux-form';
 import formInput from '../../common/formInput'
 
 class EditModal extends React.Component {
     state = {
-        clicked: false
+        clicked: false,
+        answers_id: null,
+        answers: [],
+        clicks: false,
+        questionId: null
     }
     submit = (payload) => {
+        const { name, categoryId, description, question, simple, topicId } = payload
+        const { answers, questionId } = this.state
+        console.log(name, categoryId, description, question, simple, topicId, answers)
         const { actions: { changeTestRequest } } = this.props;
-        changeTestRequest({ payload })
-        console.log(payload)
+        changeTestRequest({ questionId, name, categoryId, description, question, simple, topicId, answers })
+
+        // console.log(payload)
     }
     changeQuestion = (event) => {
-        const { value, name} = event.target
-        // const { actions: { getAnswersRequest } } = this.props;
+        const { value } = event.target
+        const { actions: { getAnswersRequest } } = this.props;
         console.log(event.target.valus, value)
-        // getAnswersRequest({ value })
-        this.setState((prevState) => ({ clicked: !prevState.clicked }))
+        getAnswersRequest({ value })
+        this.setState((prevState) => ({ clicked: !prevState.clicked, }))
+        this.setState({ questionId: value })
+
+    }
+    answersChange = (event) => {
+        const { value } = event.target
+        this.setState({ clicks: true, answers_id: value })
+    }
+    changeAnswers = (payload) => {
+        const { answers_id } = this.state
+        const { answer, price, correct } = payload
+        const value = {
+            _id: answers_id,
+            answer: answer,
+            price: +price,
+            correct: correct
+        }
+        this.setState((prevState) => ({ answers: prevState.answers.concat(value) }))
+        this.setState({ clicks: false })
+
+    }
+    deleteAnswer = () => {
+        const { answers_id } = this.state
+        const { actions: { deleteAnswerRequest } } = this.props;
+        deleteAnswerRequest({ answers_id })
+
+    }
+    deleteQuestions = () => {
+        const{questionId} =this.state
+        const { actions: { deleteQuestionRequest } } = this.props;
+        deleteQuestionRequest({questionId})
+    }
+    deleteTopic=(payload)=>{
+        const{topicId}=payload
+        const{actions:{deleteTopicRequest}} =this.props;
+        deleteTopicRequest({topicId})
+
     }
     render() {
         const { visible, handleClose: { closeModal }, inputData, editLoads, initialValues, arrayQuestions: { questions, _id }, answers, handlers: { handelClick }, click, handleSubmit } = this.props;
-        const { submit } = this
-        const { clicked } = this.state
-        console.log(initialValues)
+        const { submit, answersChange, changeAnswers, deleteAnswer, deleteQuestions, deleteTopic } = this
+        const { clicked, clicks } = this.state
+        console.log(this.state)
         return (
-            <Modal footer={false} title="Basic Modal" visible={visible} onCancel={closeModal} >
-                <form onSubmit={handleSubmit(submit)}>
-                    <Field name="name" type="name" component={formInput} />
-                    <Field name="description" type="description" component={formInput} />
-
+            <Modal show={visible} onHide={closeModal} aria-labelledby="contained-modal-title-vcenter" >
+                < Modal.Header closeButton >
+                    < Modal.Title className="text-center  text-white font-ci font-ci-bold" >Changes Test  </ Modal.Title >
+                </ Modal.Header >
+                < Modal.Body >
+                    <h4 class="text-center  text-white font-ci font-ci-bold">Topic</h4>
+                    <form onSubmit={handleSubmit(submit)}>
+                        <Field name="name" type="name" component={formInput} className="form-control mb-3" />
+                        <h4 class="text-center  text-white font-ci font-ci-bold">Description</h4>
+                        <Field name="description" type="description" component={formInput} className="form-control mb-3" />
 
-                    <select class="custom-select bg-mist bg-mist-op text-white mt-3 mb-3" onChange={this.changeQuestion} >
-                        <option selected>Question</option>
-                        {questions !== null
-                            ?
-                            questions.map(el =>
-                                <option key={el._id} name={el._id} value={el.question}>{el.question}</option>
+                        <h4 class="text-center  text-white font-ci font-ci-bold">Questions</h4>
+                        <select class="custom-select bg-mist bg-mist-op text-white mt-3 mb-3" onChange={this.changeQuestion} >
+                            <option selected>Question</option>
+                            {questions !== null
+                                ?
+                                questions.map(el =>
+                                    <option key={el._id} name={el._id} value={el._id}>{el.question}</option>
 
 
-                            )
-                            : null
+                                )
+                                : null
+                            }
+                        </select>
+                        {
+                            clicked
+                                ?
+                                <React.Fragment>
+                                    <h4 class="text-center  text-white font-ci font-ci-bold">Questions and Simple</h4>
+                                    <Field name="question" type="question" component={formInput} />
+                                    <Field name="simple" type="checkbox" component={formInput} />
+                                    <button className="btn  btn-outline-light bg-stone m-3" onClick={handleSubmit(deleteQuestions)} >Change Question</button >
+                                </React.Fragment>
+                                : null
                         }
-                    </select>
-                    {
-                        clicked
-                        ?
-                        <React.Fragment>
-                        <Field name ="question" type ="question" component ={formInput}/>
-                        <Field name ="simple" type ="checkbox" component ={formInput}/>
-                        </React.Fragment>
-                        :null
-                    }
-                    <ul class="list-group list-group-flush">
+                        <ul class="list-group list-group-flush">
+                            {
+                                clicked
+                                    ?
+                                    <select class="custom-select bg-mist bg-mist-op text-white mt-3 mb-3" onChange={answersChange} >
+                                        <option selected>Aswers</option>
+                                        {answers !== null
+                                            ?
+                                            answers.map(el =>
+                                                <option key={el._id} name={el._id} value={el._id}>{el.answer}</option>
 
-                        {
+
+                                            )
+                                            : null
+                                        }
+                                    </select>
+                                    : null
+                            }
+                            {
+                                clicks
+                                    ?
+                                    <React.Fragment>
+                                        <Field name="answer" type="answer" component={formInput} className="form-control mb-3" />
+                                        <Field name="correct" type="checkbox" component={formInput} />
+                                        <Field name="price" type="number" component={formInput} />
+                                        <div>
+                                            <button className="btn  btn-outline-light bg-stone m-3" onClick={handleSubmit(deleteAnswer)}>Delete Answer</button>
+                                            <button className="btn  btn-outline-light bg-stone m-3" onClick={handleSubmit(changeAnswers)} >Change Answers</button >
+                                        </div>
+                                    </React.Fragment>
+                                    : null
+                            }
+                            {/* {
                             answers !== null
                                 ?
                                 answers.map(el =>
 
-                                    !click
-                                        ?
+
+                                   
                                         <React.Fragment>
                                             <li class="list-group-item" key={el._id} id={el._id}>{el.answer}</li>
                                             <button type="button" onClick={handelClick.bind(null, { el })}>Change</button>
@@ -68,19 +152,28 @@ class EditModal extends React.Component {
                                         </React.Fragment>
                                         :
                                         <React.Fragment>
-                                            <Field name="answer" type="answer" component={formInput} />
+                                            <Field name="answer" type="answer" component={formInput} className="form-control mb-3" />
                                             <Field name="corrent" type="checkbox" component={formInput} />
                                             <Field name="price" type="price" component={formInput} />
-                                            {/* <button onClick={handelClick.bind(null, { el })}>Change</button>
-                                    <button>Delete</button> */}
-                                        </React.Fragment>
+                                            <button onClick={handelClick.bind(null, { el })}>Change</button>
+                                    <button>Delete</button>
+                </React.Fragment>
                                 )
                                 :
                                 null
-                        }
-                        <button>create</button>
-                    </ul>
-                </form>
+                        } */}
+
+
+
+                        </ul>
+                    </form>
+                </ Modal.Body >
+                < Modal.Footer>
+                <React.Fragment>
+                <button className="btn  btn-outline-light bg-stone m-3" onClick={handleSubmit(deleteTopic)}>Delete Answer</button>
+                    <button type="submit" >Change</button>
+                    </React.Fragment>
+                </ Modal.Footer >
             </Modal>
         );
     }

+ 7 - 5
src/components/admin/getChangeDeleteTest/index.js

@@ -8,6 +8,7 @@ import { deleteQuestionRequest } from '../../../actions/admin/changeTest/deleteQ
 import { getCategoryRequest } from '../../../actions/admin/category/getCategory';
 import { getAnswersRequest } from '../../../actions/admin/changeTest/getAnswers';
 import { changeTestRequest } from '../../../actions/admin/changeTest/changeTest';
+import {deleteAnswerRequest} from '../../../actions/admin/changeTest/deleteAnswer';
 
 import PropagateLoader from 'react-spinners/PropagateLoader';
 
@@ -86,7 +87,7 @@ class ChangeTest extends React.Component {
         const initialValues = {
             ...state
         }
-        const { category: { data, isFlag }, topic, arrayQuestions, getAnswersRequest, arrayAnswers, changeTestRequest } = this.props
+        const { category: { data, isFlag },deleteTopic, topic, arrayQuestions, getAnswersRequest,deleteTopicRequest, arrayAnswers, changeTestRequest, newTopic ,deleteAnswerRequest,deleteQuestionRequest} = this.props
         console.log(this.state)
 
         return (
@@ -103,8 +104,8 @@ class ChangeTest extends React.Component {
                                 topic.isFlag
                                     ?
                                     <React.Fragment>
-                                        <GetTopic handlers={{ openEditModal }} topic={topic}></GetTopic>
-                                        <EditModal className="bg-mist" visible={openModal} handlers={{ handelClick }} click={click} answers={answers} actions={{ getAnswersRequest, changeTestRequest }} arrayQuestions={arrayQuestions} initialValues={initialValues}
+                                        <GetTopic handlers={{ openEditModal }} topicId={topicId} deleteTopic={deleteTopic} newTopic={newTopic} topic={topic}></GetTopic>
+                                        <EditModal className="bg-mist"  visible={openModal}  handlers={{ handelClick }} click={click} answers={answers} actions={{ getAnswersRequest,deleteTopicRequest,deleteAnswerRequest,deleteQuestionRequest, changeTestRequest }} arrayQuestions={arrayQuestions} initialValues={initialValues}
                                             handleClose={{ closeModal }}></EditModal>
                                     </React.Fragment>
                                     :
@@ -127,10 +128,11 @@ const
         deleteTopic: state.deleteTopic,
         deleteQuestion: state.deleteQuestion,
         category: state.category,
-        arrayAnswers: state.arrayAnswers
+        arrayAnswers: state.arrayAnswers,
+        newTopic:state.newTopic
 
     });
 
-const mapDispatchToProps = dispatch => bindActionCreators({ getCategoryRequest, getTopicRequest, changeTestRequest, getQuestionsRequest, deleteTopicRequest, deleteQuestionRequest, getAnswersRequest }, dispatch);
+const mapDispatchToProps = dispatch => bindActionCreators({ getCategoryRequest,deleteAnswerRequest, getTopicRequest, changeTestRequest, getQuestionsRequest, deleteTopicRequest, deleteQuestionRequest, getAnswersRequest }, dispatch);
 
 export default connect(mapStateToProps, mapDispatchToProps)(ChangeTest);

+ 30 - 0
src/components/user/Test/getTest.js

@@ -0,0 +1,30 @@
+import React, { Component } from "react";
+import { Field, reduxForm } from 'redux-form';
+import formInput from '../../common/formInput'
+
+class Test extends React.Component {
+
+    render() {
+        const { data: { question } } = this.props
+        return (
+            <form >
+
+                <h4 className="text-white font-ci">{question.question}</h4>
+                <div className=' d-flex flex-column'>
+                    {
+                        question.answersArr.map(el =>
+                            <div>
+                                <Field name="answer" type="checkbox" component={formInput} />
+                                <span className="text-white font-ci">{el.answer}</span>
+                                </div>
+                        )
+                    }
+                </div>
+            </form>
+        )
+    }
+}
+
+export default reduxForm({
+    form: "Test",
+})(Test)

+ 85 - 0
src/components/user/Test/index.js

@@ -0,0 +1,85 @@
+import React from 'react';
+import { connect } from 'react-redux';
+import { bindActionCreators } from 'redux';
+import {getTopicTestRequest} from '../../../actions/user/test/getTopics'
+import {startTestRequest} from '../../../actions/user/test/testStart';
+import Test from './getTest';
+	
+import ReactCSSTransitionGroup from 'react-addons-css-transition-group'
+
+class PassingTests extends React.Component {
+    state={
+        topicId:null,
+        sessionId:null
+    }
+
+componentWillMount(){
+    const{getTopicTestRequest} =this.props
+    getTopicTestRequest()
+}
+handelClick=({el:{_id}})=>{
+    const{startTestRequest}=this.props
+    startTestRequest({_id})
+    this.setState({topicId:_id})
+}
+componentWillUpdate(nextState, nextProps) {
+    const{startTest:{data}}=nextState
+    // if(data!==null){
+    //     this.setState({sessionId:data.sessionId})
+    // }
+    console.log("____nextState_____",nextState, "_____nextProps___", nextProps)
+}
+
+
+    render() {
+        const{ handelClick}=this
+        const{topicTest:{topic},startTest:{data}}=this.props;
+        console.log(this.state)
+
+
+        return (
+            <ReactCSSTransitionGroup transitionName="anim" transitionAppear={true} transitionAppearTimeout={5000} transitionEnter={false} transitionLeave={false}>
+            <div className=" profile-page d-flex flex-row font-ci padding  ">
+          
+                <div className='w-25 p-3  border rounded bg-gradient'  >
+                    {
+                        topic!==null
+                        ?
+                        topic.map(el=>
+                            <button type="button" class="text-center overflow-hidden rounded-pill btn-outline-light btn mb-4 borber bg-rgba border-0  font-ci font-ci-bold "key={el._id} id={el._id} onClick={handelClick.bind(null, { el })}>{el.name}</button>
+                        )
+                        :null
+                    }
+                </div>
+                <div className='w-75 p-3  ml-3 border rounded d-flex flex-row bg-gradient'  >
+                    {
+                        data !==null
+                        ?
+                        <Test data={data}></Test>
+                           
+                        :
+                        null
+                    } 
+                   
+                   
+                </div>
+            </div>
+
+            </ReactCSSTransitionGroup>
+
+
+        )
+    }
+
+}
+
+const
+    mapStateToProps = state => ({
+topicTest:state.topicTest,
+startTest:state.startTest
+
+    });
+
+const mapDispatchToProps = dispatch => bindActionCreators({getTopicTestRequest,startTestRequest }, dispatch);
+
+export default connect(mapStateToProps, mapDispatchToProps)(PassingTests);

+ 2 - 1
src/configs/routerConfig.js

@@ -8,6 +8,7 @@ const DeleteUser = lazy(()=>import('../components/admin/deleteUser/index'));
 const AddDeleteCategory = lazy(()=> import('../components/admin/addDeleteCategory'));
 const CreateTest = lazy(()=> import('../components/admin/CreateTest'));
 const ChangeTest = lazy(()=>import('../components/admin/getChangeDeleteTest/index'))
+const PassingTests =lazy(()=>import('../components/user/Test/index'))
 
 const SignIn = lazy(() => import('../components/public/SignIn/index'));
 const SignUp = lazy(() => import('../components/public/SignUp/index'));
@@ -49,7 +50,7 @@ export default [
     {
         path: routes.TESTS,
         access: 'user-only',
-        component: () => <div>test</div>
+        component: PassingTests
     },
     {
         path: '/admin',

+ 4 - 0
src/constants/admin.js

@@ -68,6 +68,10 @@ export const DELETE_QUESTION_REQUEST = 'DELETE_QUESTION_REQUEST';
 export const DELETE_QUESTION_REQUEST_SUCCESS = 'DELETE_QUESTION_REQUEST_SUCCESS';
 export const DELETE_QUESTION_REQUEST_FAILURE = 'DELETE_QUESTION_REQUEST_FAILURE';
 
+export const DELETE_ANSWER_REQUEST = 'DELETE_ANSWER_REQUEST';
+export const DELETE_ANSWER_REQUEST_SUCCESS = 'DELETE_ANSWER_REQUEST_SUCCESS';
+export const DELETE_ANSWER_REQUEST_FAILURE = 'DELETE_ANSWER_REQUEST_FAILURE';
+
 export const GET_ANSWERS_REQUEST = 'GET_ANSWERS_REQUEST';
 export const GET_ANSWERS_REQUEST_SUCCESS = 'GET_ANSWERS_REQUEST_SUCCESS';
 export const GET_ANSWERS_REQUEST_FAILURE = 'GET_ANSWERS_REQUEST_FAILURE';

+ 10 - 1
src/constants/user.js

@@ -9,4 +9,13 @@ export const CHANGE_EMAIL_REQUEST_FAILURE = 'CHANGE_EMAIL_REQUEST_FAILURE';
 
 export const CHANGE_PASSWORD_REQUEST = 'CHANGE_PASSWORD_REQUEST';
 export const CHANGE_PASSWORD_REQUEST_SUCCESS = 'CHANGE_PASSWORD_REQUEST_SUCCESS';
-export const CHANGE_PASSWORD_REQUEST_FAILURE = 'CHANGE_PASSWORD_REQUEST_FAILURE';
+export const CHANGE_PASSWORD_REQUEST_FAILURE = 'CHANGE_PASSWORD_REQUEST_FAILURE';
+
+export const GET_TOPIC_TEST_REQUEST = 'GET_TOPIC_TEST_REQUEST';
+export const GET_TOPIC_TEST_REQUEST_SUCCESS = 'GET_TOPIC_TEST_REQUEST_SUCCESS';
+export const GET_TOPIC_TEST_REQUEST_FAILURE = 'GET_TOPIC_TEST_REQUEST_FAILURE';
+
+export const START_TEST='https://test-app-a-level.herokuapp.com/statistics/start'
+export const START_TEST_REQUEST = 'START_TEST_REQUEST';
+export const START_TEST_REQUEST_SUCCESS = 'START_TEST_REQUEST_SUCCESS';
+export const START_TEST_REQUEST_FAILURE = 'START_TEST_REQUEST_FAILURE';

+ 3 - 3
src/reducers/admin/getCategory.js

@@ -1,7 +1,7 @@
 import * as actionTypes from '../../constants/admin';
 import initialState from './../initialState';
 
-export default function getCategory(state = initialState.category, {payload, type, error}) {
+export default function getCategory(state = initialState.category, { payload, type, error }) {
 
     switch (type) { // payload.type -> type
         case actionTypes.GET_CATEGORY_REQUEST: {
@@ -11,12 +11,12 @@ export default function getCategory(state = initialState.category, {payload, typ
             }
         }
         case actionTypes.GET_CATEGORY_REQUEST_SUCCESS: {
-            const { data:{category} } = payload;
+            const { data: { category } } = payload;
 
             return {
                 ...state,
                 isFetching: false,
-                isFlag:true,
+                isFlag: true,
                 data: category,
             }
         }

+ 1 - 0
src/reducers/admin/initialValues.js

@@ -5,6 +5,7 @@ export default function getCategory(state = initialState.initialValues, {payload
 
     switch (type) { // payload.type -> type
         case actionTypes.GET_CATEGORY_REQUEST_SUCCESS: {
+            
             return {
                 ...state,
                 categoryId:payload

+ 34 - 0
src/reducers/admin/test/newTopic.js

@@ -0,0 +1,34 @@
+import * as actionTypes from '../../../constants/admin';
+import initialState from '../../initialState';
+
+export default function newTopic(state = initialState.newTopic, {payload, type, error}) {
+
+    switch (type) { // payload.type -> type
+        case actionTypes.CHANGE_TEST_REQUEST: {
+            return {
+                ...state,
+                isFetching: false,
+                // payload
+            }
+        }
+        case actionTypes.CHANGE_TOPIC_REQUEST_SUCCESS: {
+const {data:{topic}}=payload
+            return {
+                ...state,
+                isFetching: true,
+                data:topic
+            }
+        }
+        // case actionTypes.CREATE_TOPICS_REQUEST_FAILURE: {
+
+        //     return {
+        //         ...state,
+        //         isFetching: false,
+        //         error
+        //     }
+        // }
+        default: {
+            return state;
+        }
+    }
+}

+ 10 - 4
src/reducers/index.js

@@ -13,14 +13,17 @@ import deleteQuestion from './admin/test/deleteQuestion';
 import  initialValues from './admin/initialValues';
 import arrayAnswers from './admin/test/getAnswers'
 import changeUser from './admin/test/changeUser';
-import deleteUsers from './admin/test/deleteUsers'
-
+import deleteUsers from './admin/test/deleteUsers';
+import newTopic from './admin/test/newTopic';
 import changeCategory from './admin/changeCategory';
-import arrayQuestions from './admin/test/getQuestions'
+import arrayQuestions from './admin/test/getQuestions';
+
+import topicTest from './user/getTopicTest'
 import chageLoginReducer from './user/chageLogin';
 import changeEmailReducer from './user/changeEmail';
 import myUser from './user/myUser'
 import users from './admin/getUsers'
+import startTest from './user/startTest'
 
 export default combineReducers({
     signIn,
@@ -40,5 +43,8 @@ export default combineReducers({
     initialValues, 
     arrayAnswers,
     changeUser,
-    deleteUsers
+    deleteUsers, 
+    newTopic,
+    topicTest,
+    startTest
 })

+ 22 - 1
src/reducers/initialState.js

@@ -94,5 +94,26 @@ export default {
         data: null,
         isFetching: false,
         error: null
-    }
+    },
+    newTopic:{
+        data: null,
+        isFetching: false,
+        error: null
+    },
+    topicTest:{
+        topic:null,
+        isFetching: true,
+        isFlag:false,
+    },
+    newTopic:{
+        data: null,
+        isFetching: false,
+        error: null
+    },
+    startTest:{
+        isFetching: false,
+        isFlag: false,
+        data: null,
+        error: null
+    },
 }

+ 36 - 0
src/reducers/user/getTopicTest.js

@@ -0,0 +1,36 @@
+import * as actionTypes from '../../constants/user';
+import initialState from '../initialState';
+
+export default function getTopicTest(state = initialState.startTest, {payload, type, error}) {
+
+    switch (type) { 
+        case actionTypes.GET_TOPIC_TEST_REQUEST: {
+            return {
+                ...state,
+                isFetching: true,
+                isFlag:false
+            }
+        }
+        case actionTypes.GET_TOPIC_TEST_REQUEST_SUCCESS: {
+const {data:{topics}} =payload
+            return {
+                ...state,
+                isFetching: false,
+                isFlag:true,
+                topic:topics
+            }
+        }
+        case actionTypes.GET_TOPIC_TEST_REQUEST_FAILURE: {
+
+            return {
+                ...state,
+                isFetching: false,
+                isFlag:false,
+                error
+            }
+        }
+        default: {
+            return state;
+        }
+    }
+}

+ 34 - 0
src/reducers/user/startTest.js

@@ -0,0 +1,34 @@
+import * as actionTypes from '../../constants/user';
+import initialState from '../initialState';
+
+export default function startTest(state = initialState.startTest, {  type, payload }) {
+    switch (type) {
+        case actionTypes.START_TEST_REQUEST: {
+            console.log(payload)
+            return {
+                ...state,
+                isFetching: true,
+                payload
+            }
+        }
+        case actionTypes.START_TEST_REQUEST_SUCCESS: {
+            const {data} =payload
+            return {
+                ...state,
+                isFetching: false,
+                data:data
+            }
+        }
+        case actionTypes.START_TEST_REQUEST_FAILURE: {
+            const { error } = payload;
+            return {
+                ...state,
+                isFetching: false,
+                error
+            }
+        }
+        default: {
+            return state;
+        }
+    }
+}

+ 56 - 42
src/sagas/admin/test/changeTest.js

@@ -2,66 +2,80 @@ import { put, call, all } from 'redux-saga/effects';
 import axios from 'axios';
 
 import { CREATE_QUESTIONS, CREATE_ANSVERS, CREATE_TOPICS } from '../../../constants/admin';
-import { createQuestionSuccess, createAnswersSuccess, createTestFailure } from '../../../actions/admin/test/createTest';
+import { changeTopicSuccess, changeQuestionSuccess, changeAnswersSuccess, createTopicsFailure} from '../../../actions/admin/changeTest/changeTest';
 import storageKey from '../../../utils/storageKey';
 
 const getItem = localStorage.getItem(storageKey);
 
-export default function* ( payload) {
-    console.log(payload)
-    // try {
-    //     console.log(questions, array, simple, _id)
+export default function* ( {payload:{name,categoryId,description,question,simple,topicId,questionId,answers}}) {
+    // console.log(payload)
+    try {
 
-    //     const headers = {
-    //         "Content-Type": "application/json",
-    //         "Authorization": `Bearer ${getItem}`
-    //     }
+        const headers = {
+            "Content-Type": "application/json",
+            "Authorization": `Bearer ${getItem}`
+        }
 
 
 
-        // const topic = yield call(
-        //     axios, {
-        //         url: `https://test-app-a-level.herokuapp.com/questions`,
-        //         method: 'POST',
-        //         headers,
-        //         data: {
-        //             topicId: _id,
-        //             question: questions,
-        //             simple: simple
-        //         }
+        const topic = yield call(
+            axios, {
+                url: `${CREATE_TOPICS}/${topicId}`,
+                method: 'PUT',
+                headers,
+                data: {
+                    name: name,
+                    categotyId: categoryId,
+                    description: description
+                }
 
-        //     }
-        // )
+            }
+        )
 
 
         // const { data: { question } } = questionses;
         // console.log(typeof( question._id))
 
-        // yield put(createQuestionSuccess(questionses));
-
-        // const responses = yield all(array.map(el => {
-        //     console.log(el. price, el.correct, el.answer)
-        //     return call(axios, {
-        //         url: CREATE_ANSVERS,
-        //         method: 'POST',
-        //         headers,
-        //         data: {
-        //             answer: el.answer,
-        //             price: el.price,
-        //             correct: el.correct,
-        //             questionId: question._id
+        yield put(changeTopicSuccess(topic));
+        
+        const questionses = yield call(
+            axios, {
+                url: `${CREATE_QUESTIONS}/${questionId}`,
+                method: 'PUT',
+                headers,
+                data: {
+                    question: question,
+                    simple: simple,
+                    topicId: topicId
+                }
+
+            }
+        )
+        yield put(changeQuestionSuccess(questionses));
+
+
+        const answer = yield all(answers.map(el => {
+            console.log(el. price, el.correct, el.answer)
+            return call(axios, {
+                url: `${CREATE_ANSVERS}/${el._id}`,
+                method: 'PUT',
+                headers,
+                data: {
+                    answer: el.answer,
+                    price: el.price,
+                    correct: el.correct,
                      
-        //         }
+                }
 
 
-        //     })
-        // }))
+            })
+        }))
 
 
-        // yield put(createAnswersSuccess(responses));
+        yield put(changeAnswersSuccess(answer));
 
-    // }
-    // catch ({ message }) {
-    //     yield put(createTestFailure(message));
-    // }
+    }
+    catch ({ message }) {
+        yield put(createTopicsFailure(message));
+    }
 }

+ 28 - 0
src/sagas/admin/test/deleteAnswer.js

@@ -0,0 +1,28 @@
+import { put, call } from 'redux-saga/effects';
+import axios from 'axios';
+
+import { CREATE_ANSVERS} from '../../../constants/admin';
+import { deleteAnswerSuccess, deleteAnswerFailure } from '../../../actions/admin/changeTest/deleteAnswer';
+import storageKey from '../../../utils/storageKey';
+
+const getItem = localStorage.getItem(storageKey);
+
+export default function* ({ payload: { answers_id } }) {
+    try {
+        const config = {
+            headers: {
+                "Authorization": `Bearer ${getItem}`
+            }
+        }
+
+        const answer = yield call(() =>
+            axios.delete(`${CREATE_ANSVERS}${'/'}${answers_id}`, config)
+
+        )
+
+        yield put(deleteAnswerSuccess(answer));
+    }
+    catch ({ message }) {
+        yield put(deleteAnswerFailure(message));
+    }
+}

+ 2 - 2
src/sagas/admin/test/deleteQuestion.js

@@ -7,7 +7,7 @@ import storageKey from '../../../utils/storageKey';
 
 const getItem = localStorage.getItem(storageKey);
 
-export default function* ({ payload: { _id } }) {
+export default function* ({ payload: { questionId } }) {
     try {
         const config = {
             headers: {
@@ -16,7 +16,7 @@ export default function* ({ payload: { _id } }) {
         }
 
         const question = yield call(() =>
-            axios.delete(`${CREATE_QUESTIONS}${'/'}${_id}`, config)
+            axios.delete(`${CREATE_QUESTIONS}${'/'}${questionId}`, config)
 
         )
 

+ 2 - 2
src/sagas/admin/test/deleteTopic.js

@@ -7,7 +7,7 @@ import storageKey from '../../../utils/storageKey';
 
 const getItem = localStorage.getItem(storageKey);
 
-export default function* ({payload:{_id}}) {
+export default function* ({payload:{topicId}}) {
     try {
         const config = {
             headers: {
@@ -16,7 +16,7 @@ export default function* ({payload:{_id}}) {
         }
 
         const category = yield call(() =>
-            axios.delete(`${CREATE_TOPICS}${'/'}${_id}`, config)
+            axios.delete(`${CREATE_TOPICS}${'/'}${topicId}`, config)
                 
         )
 

+ 3 - 0
src/sagas/admin/test/index.js

@@ -10,6 +10,7 @@ import deleteTopic from './deleteTopic';
 import deleteQuestion from './deleteQuestion'
 import getAnswers from './getAnswers';
 import changeTest from './changeTest';
+import deleteAnswer from './deleteAnswer';
 
 export default function* () {
     yield takeEvery(actionTypes.CREATE_TOPICS_REQUEST, createTopic);
@@ -20,6 +21,8 @@ export default function* () {
     yield takeEvery(actionTypes.DELETE_QUESTION_REQUEST,deleteQuestion);
     yield takeEvery(actionTypes.GET_ANSWERS_REQUEST,getAnswers);
     yield takeEvery(actionTypes.CHANGE_TEST_REQUEST,changeTest);
+    yield takeEvery(actionTypes.DELETE_ANSWER_REQUEST,deleteAnswer);
+
 
 
 

+ 3 - 0
src/sagas/index.js

@@ -3,6 +3,7 @@ import auth from './auth'
 import user from './user/index'
 import admin from './admin/category/index';
 import usersAdmin from './admin/users/index';
+import test from './user/test/index'
 
 import adminTest from './admin/test/index'
 
@@ -12,4 +13,6 @@ export default function*() {
     yield fork(admin);
     yield fork(adminTest);
     yield fork(usersAdmin);
+    yield fork(test);
+
 }

+ 29 - 0
src/sagas/user/test/getTopicTest.js

@@ -0,0 +1,29 @@
+import { put, call, all } from 'redux-saga/effects';
+import axios from 'axios';
+
+import { CREATE_TOPICS } from '../../../constants/admin';
+import { getTopicTestSuccess, getTopicTestFailure} from '../../../actions/user/test/getTopics';
+import storageKey from '../../../utils/storageKey';
+
+const getItem = localStorage.getItem(storageKey);
+
+export default function* () {
+    try {
+         
+        const config ={
+           headers: {
+                "Authorization": `Bearer ${getItem}`
+            }
+        }
+        
+        const topic = yield call(() =>
+            axios.get(CREATE_TOPICS ,config)
+        )
+
+    yield put(getTopicTestSuccess(topic));
+
+}
+    catch ({ message }) {
+    yield put(getTopicTestFailure(message));
+}
+}

+ 16 - 0
src/sagas/user/test/index.js

@@ -0,0 +1,16 @@
+
+import * as actionTypes from '../../../constants/user';
+
+import { takeEvery } from 'redux-saga/effects';
+import getTopicTest from './getTopicTest';
+import startTest from './startTest'
+export default function* () {
+    yield takeEvery(actionTypes.GET_TOPIC_TEST_REQUEST,getTopicTest);
+    yield takeEvery(actionTypes.START_TEST_REQUEST,startTest);
+
+
+
+
+
+
+}

+ 39 - 0
src/sagas/user/test/startTest.js

@@ -0,0 +1,39 @@
+import { put, call, all } from 'redux-saga/effects';
+import axios from 'axios';
+
+import { START_TEST } from '../../../constants/user';
+import { startTestSuccess, startTestFailure } from '../../../actions/user/test/testStart';
+import storageKey from '../../../utils/storageKey';
+
+const getItem = localStorage.getItem(storageKey);
+
+export default function* ({ payload: { _id } }) {
+    console.log(_id)
+    try {
+
+
+        const headers = {
+            "Content-Type": "application/json",
+            "Authorization": `Bearer ${getItem}`
+        }
+
+        const start = yield call(
+            axios, {
+                url: START_TEST,
+                method: 'POST',
+                headers,
+                data: {
+                    topicId:_id
+                }
+
+            }
+        )
+
+
+        yield put(startTestSuccess(start));
+
+    }
+    catch ({ message }) {
+        yield put(startTestFailure(message));
+    }
+}

+ 4 - 0
src/styles/abstracts/_theme.scss

@@ -71,3 +71,7 @@
 .padding{
     padding: 15vh
 }
+.modal-content{
+    background:linear-gradient(to top, rgba(42, 49, 50, 1), rgba(51, 107, 135, 0.7) );
+
+}