|
@@ -1,19 +1,68 @@
|
1
|
|
-import {
|
2
|
|
- Typography, Button
|
3
|
|
-} from '@mui/material';
|
|
1
|
+import { useState, useEffect, useRef } from 'react';
|
|
2
|
+import { Typography, Button, Box, Paper, Divider } from '@mui/material';
|
|
3
|
+
|
|
4
|
+import useAuth from '../Auth/useAuth.js'
|
|
5
|
+import { Service } from '../Utils/HTTP.js';
|
|
6
|
+
|
|
7
|
+import { TestCard } from '../Components/HomeUser/TestCard';
|
4
|
8
|
|
5
|
9
|
export function HomeUser(){
|
6
|
|
- return (
|
7
|
|
- <div>
|
8
|
|
- <Typography paragraph>
|
9
|
|
- Bienvenido User
|
10
|
|
- </Typography>
|
11
|
|
- <div>
|
12
|
|
- <Button onClick={() => console.log("close")}
|
13
|
|
- variant="contained">
|
14
|
|
- Cerrar Session
|
15
|
|
- </Button>
|
|
10
|
+
|
|
11
|
+ const auth = useAuth();
|
|
12
|
+ const token = useRef(auth.getToken());
|
|
13
|
+ const [tests, setTests] = useState([]);
|
|
14
|
+
|
|
15
|
+ useEffect(() => {
|
|
16
|
+
|
|
17
|
+ let { email , password} = auth.getProfile();
|
|
18
|
+ let rest = new Service(`/plaza/contrasenia/${password}/${email}`);
|
|
19
|
+ rest
|
|
20
|
+ .get(token.current)
|
|
21
|
+ .then(({ data }) => {
|
|
22
|
+ console.log("data >>> ", data)
|
|
23
|
+ setTests(data.tests)
|
|
24
|
+ })
|
|
25
|
+ .catch(erro => {
|
|
26
|
+ console.error("ERR : ", erro)
|
|
27
|
+ })
|
|
28
|
+
|
|
29
|
+ },[auth])
|
|
30
|
+
|
|
31
|
+ return(
|
|
32
|
+ <div className="content-section">
|
|
33
|
+ <div className="main">
|
|
34
|
+ <Box sx={{ width: '100%' }}>
|
|
35
|
+ <Paper elevation={0} sx={{ mb: 2, padding: 2, height: '100%', minHeight: '95vh', boxShadow: 'none !important' }}>
|
|
36
|
+ <h2>
|
|
37
|
+ Bienvenido al sistemas de pruebas psicometricas.
|
|
38
|
+ </h2>
|
|
39
|
+ <h3>Instrucciones Generales</h3>
|
|
40
|
+ <Typography>
|
|
41
|
+ Bienvenido, el sistema tiene como objetivo evaluar diferentes caracteristicas como medir y cuantificar los procesos cognoscitivos de la mente humana.
|
|
42
|
+
|
|
43
|
+ Parar resolver las pruebas que estan 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 concentracion.
|
|
44
|
+
|
|
45
|
+ </Typography>
|
|
46
|
+
|
|
47
|
+ <Divider style={{margin : 5}}/>
|
|
48
|
+
|
|
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
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+ </Paper>
|
|
62
|
+ <Button onClick={auth.logout}>Salir</Button>
|
|
63
|
+ </Box>
|
16
|
64
|
</div>
|
17
|
65
|
</div>
|
18
|
66
|
)
|
|
67
|
+
|
19
|
68
|
}
|