Reac front end for psicometric app

Home.jsx 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import React from 'react'
  2. import { Col, Row } from 'react-bootstrap'
  3. import { PersonOutline, VerifiedUser, ListAlt } from '@mui/icons-material/'
  4. import Actividades from '../Components/Home/Actividades'
  5. import Candidatos from '../Components/Home/Candidatos'
  6. import { Card } from '../Components/Card';
  7. import { useSelector } from 'react-redux';
  8. import { Service } from '../Utils/HTTP.js'
  9. import { useQuery } from 'react-query';
  10. export function Home() {
  11. const auth = useSelector((state) => state.token)
  12. // const profile = useSelector((state) => state.user.profile)
  13. const getAllPwd = async () => {
  14. let rest = new Service('/contrasenia/getallbyidUsr');
  15. return await rest.getQuery(auth.token)
  16. }
  17. const { data, status } = useQuery('homepwd', getAllPwd);
  18. let is_loading = status === "loading";
  19. console.log({is_loading})
  20. return (
  21. <section >
  22. <div className="content-section">
  23. <div className="main">
  24. <div className="panel_options">
  25. <Row>
  26. <Col md="4">
  27. <Card
  28. quantity={data?.data?.length || 0}
  29. to='/dashboard/contrasenas'
  30. title='CONTRASEÑAS'
  31. icon={VerifiedUser}
  32. />
  33. </Col>
  34. <Col md="4">
  35. <Card
  36. quantity={504} to='/dashboard/expedientes' title='EXPEDIENTES' icon={PersonOutline} />
  37. </Col>
  38. <Col md="4">
  39. <Card
  40. quantity={343} to="/dashboard/puestos" title='PUESTOS' icon={ListAlt} />
  41. </Col>
  42. </Row>
  43. </div>
  44. <div className="historial_candidatos">
  45. <Row>
  46. <Col md="8">
  47. <Candidatos
  48. passwords={data?.data || []}
  49. />
  50. </Col>
  51. <Col md="4">
  52. <Actividades />
  53. </Col>
  54. </Row>
  55. </div>
  56. </div>
  57. </div>
  58. </section>
  59. )
  60. }