|
@@ -1,65 +1,65 @@
|
1
|
1
|
import { useState, useEffect } from 'react';
|
2
|
|
-import { Typography, Button, Box, Paper, Divider } from '@mui/material';
|
|
2
|
+import { Typography, Box, Paper, Divider } from '@mui/material';
|
3
|
3
|
|
4
|
|
-import useAuth from '../Auth/useAuth.js'
|
5
|
4
|
import { Service } from '../Utils/HTTP.js';
|
6
|
|
-
|
7
|
5
|
import { TestCard } from '../Components/HomeUser/TestCard';
|
8
|
6
|
import { useSelector } from 'react-redux';
|
|
7
|
+import { Link } from 'react-router-dom'
|
9
|
8
|
|
10
|
9
|
export function HomeUser(){
|
11
|
10
|
|
12
|
|
- const auth = useAuth();
|
13
|
|
- // const token = useRef(auth.getToken());
|
14
|
|
- const [tests, setTests] = useState([]);
|
15
|
|
- const [password, setPasword] = useState({});
|
16
|
|
- const state = useSelector( state => state.token);
|
|
11
|
+ const [tests, setTests] = useState([]);
|
|
12
|
+ const [password, setPasword] = useState({});
|
|
13
|
+ const token = useSelector( state => state.token.token);
|
|
14
|
+ const profile = useSelector( state => state.user.profile);
|
|
15
|
+ console.log(profile)
|
17
|
16
|
|
18
|
|
- useEffect(() => {
|
19
|
|
- let { email , password} = auth.getProfile();
|
20
|
|
- let rest = new Service(`/plaza/contrasenia/${password}/${email}`);
|
21
|
|
- rest
|
22
|
|
- .get(state.token)
|
23
|
|
- .then(({ data }) => {
|
24
|
|
- setTests(data.tests)
|
25
|
|
- delete data.tests
|
26
|
|
- setPasword(data);
|
27
|
|
- })
|
28
|
|
- .catch(erro => {
|
29
|
|
- console.error("ERR : ", erro)
|
30
|
|
- })
|
|
17
|
+ useEffect(() => {
|
|
18
|
+ let { email , password} = profile
|
|
19
|
+ let rest = new Service(`/plaza/contrasenia/${password}/${email}`);
|
|
20
|
+ rest
|
|
21
|
+ .get(token.token)
|
|
22
|
+ .then(({ data }) => {
|
|
23
|
+ setTests(data.tests)
|
|
24
|
+ delete data.tests
|
|
25
|
+ setPasword(data);
|
|
26
|
+ })
|
|
27
|
+ .catch(erro => {
|
|
28
|
+ console.error("ERR : ", erro)
|
|
29
|
+ })
|
31
|
30
|
|
32
|
|
- },[state,auth])
|
|
31
|
+ },[token, profile])
|
33
|
32
|
|
34
|
|
- return(
|
35
|
|
- <div className="content-section">
|
36
|
|
- <div className="main">
|
37
|
|
- <Box sx={{ width: '100%' }}>
|
38
|
|
- <Paper elevation={2} sx={{ mb: 2, padding: 2, height: '100%', minHeight: '95vh'}}>
|
39
|
|
- <h2>
|
40
|
|
- Bienvenido al sistemas de pruebas psicometricas.
|
41
|
|
- </h2>
|
42
|
|
- <h3>Instrucciones Generales</h3>
|
43
|
|
- <Typography>
|
|
33
|
+ return(
|
|
34
|
+ <div className="content-section">
|
|
35
|
+ <div className="main">
|
|
36
|
+ <Box sx={{ width: '100%' }}>
|
|
37
|
+ <Paper elevation={2} sx={{ mb: 2, padding: 2, height: '100%', minHeight: '95vh'}}>
|
|
38
|
+ <h2>
|
|
39
|
+ Bienvenido al sistemas de pruebas psicometricas.
|
|
40
|
+ </h2>
|
|
41
|
+ <h3>Instrucciones Generales</h3>
|
|
42
|
+ <Typography>
|
44
|
43
|
|
45
|
|
-Bienvenido, el sistema tiene como objetivo evaluar diferentes características como medir y cuantificar los procesos cognoscitivos de la mente humana. Parar resolver las pruebas que están asignadas te recomendamos busques un lugar apropiado, ya que necesitaras en promedio 2 horas libre y es importante que se tenga el 100% de tu concentración.
|
46
|
|
- </Typography>
|
47
|
|
- <Divider style={{margin : 5}}/>
|
48
|
|
- <h5>Pruebas para {password.nombrepuesto}</h5>
|
49
|
|
- <div className="test_list" style={{ marginTop :15 }}>
|
50
|
|
- {
|
51
|
|
- tests.map( test => {
|
52
|
|
- return (
|
53
|
|
- <TestCard key={test.id} test={test} />
|
54
|
|
- )
|
55
|
|
- })
|
56
|
|
- }
|
57
|
|
- </div>
|
58
|
|
- </Paper>
|
59
|
|
- <Button onClick={auth.logout}>Salir</Button>
|
60
|
|
- </Box>
|
|
44
|
+ Bienvenido, el sistema tiene como objetivo evaluar diferentes características como medir y cuantificar los procesos cognoscitivos de la mente humana. Parar resolver las pruebas que están asignadas te recomendamos busques un lugar apropiado, ya que necesitaras en promedio 2 horas libre y es importante que se tenga el 100% de tu concentración.
|
|
45
|
+ </Typography>
|
|
46
|
+ <Divider style={{margin : 5}}/>
|
|
47
|
+ <h5>Pruebas para {password.nombrepuesto}</h5>
|
|
48
|
+ <div className="test_list" style={{ marginTop :15 }}>
|
|
49
|
+ {
|
|
50
|
+ tests.map( test => {
|
|
51
|
+ return (
|
|
52
|
+ <Link to={`/user/prueba/${test.id}`}>
|
|
53
|
+ <TestCard key={test.id} test={test} />
|
|
54
|
+ </Link>
|
|
55
|
+ )
|
|
56
|
+ })
|
|
57
|
+ }
|
61
|
58
|
</div>
|
62
|
|
- </div>
|
63
|
|
- )
|
|
59
|
+ </Paper>
|
|
60
|
+ </Box>
|
|
61
|
+ </div>
|
|
62
|
+ </div>
|
|
63
|
+ )
|
64
|
64
|
|
65
|
65
|
}
|