Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 349 | Rev 351 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 349 Rev 350
Línea 11... Línea 11...
11
    /**
11
    /**
12
     * Send form data
12
     * Send form data
13
     */
13
     */
14
    const handleSubmit = async () => {
14
    const handleSubmit = async () => {
15
        if (validateForm()) {
15
        if (validateForm()) {
-
 
16
            console.log(test);
16
            await axios.post(action, test).then((response) => {
17
            await axios.post(action, test).then((response) => {
17
                if (response.data.success) {
18
                if (response.data.success) {
18
                    console.info('Formulario almacenado');
19
                    console.info('Formulario almacenado');
19
                    setTest(null);
20
                    setTest(null);
20
                }
21
                }
Línea 30... Línea 31...
30
    const handleAnswer = (slug_section, slug_question, answer) => {
31
    const handleAnswer = (slug_section, slug_question, answer) => {
31
        test.content.filter((section) => {
32
        test.content.filter((section) => {
32
            if (section.slug_section == slug_section) {
33
            if (section.slug_section == slug_section) {
33
                section.questions.map((question) => {
34
                section.questions.map((question) => {
34
                    if (question.slug_question == slug_question) {
35
                    if (question.slug_question == slug_question) {
35
                        if(question.type == 'multiple'){
36
                        question.type == 'multiple' ?
36
 
-
 
37
                            if(!question.answer){
37
                            !question.answer ?
38
                                question.answer = [answer];
38
                                question.answer = [answer] :
39
                            }else{
-
 
40
                               question.answer.push(answer)
39
                                question.answer.push(answer)
41
                            }
-
 
42
                           
-
 
43
 
-
 
44
                        } else{
-
 
45
                            question.answer = answer;
40
                            : question.answer = answer;
46
                        }
-
 
47
                          
-
 
48
                            
-
 
Línea 49... Línea 41...
49
 
41
 
50
                    }
42
                    }
51
                })
43
                })
52
            }
44
            }
53
        });
-
 
54
        console.log(test);
45
        });
55
        setTest(test);
46
        setTest(test);
56
    }
47
    }
57
    /**
48
    /**
58
     * Check if there are questions to answer
49
     * Check if there are questions to answer