|
@@ -3,27 +3,24 @@ import { default as CustomToolbar } from '../Components/Password/CustomToolbar';
|
3
|
3
|
import { Paper, Box, ThemeProvider } from '@mui/material';
|
4
|
4
|
|
5
|
5
|
import MUIDataTable from "mui-datatables";
|
6
|
|
-import { encabezados } from '../Components/Password/Rows';
|
|
6
|
+import { Encabezados, Build } from '../Components/Password/Rows';
|
7
|
7
|
import { TableStyle, TextLabels } from '../Components/Password/TableStyle'
|
8
|
8
|
|
|
9
|
+import { useQuery } from 'react-query';
|
|
10
|
+import { Service } from '../Utils/HTTP.js'
|
|
11
|
+import useAuth from '../Auth/useAuth'
|
|
12
|
+
|
9
|
13
|
export function Contrasv2() {
|
10
|
14
|
|
11
|
|
- const columns = encabezados.map(({ label }) => label); //["Name", "Company", "City", "State"];
|
12
|
|
-
|
13
|
|
- const data = [
|
14
|
|
- ["Joe James", "Test Corp", "Yonkers", "NY"],
|
15
|
|
- ["John Walsh", "Test Corp", "Hartford", "CT"],
|
16
|
|
- ["Bob Herm", "Test Corp", "Tampa", "FL"],
|
17
|
|
- ["James Houston", "Test Corp", "Dallas", "TX"],
|
18
|
|
- ["Joe James", "Test Corp", "Yonkers", "NY"],
|
19
|
|
- ["John Walsh", "Test Corp", "Hartford", "CT"],
|
20
|
|
- ["Bob Herm", "Test Corp", "Tampa", "FL"],
|
21
|
|
- ["James Houston", "Test Corp", "Dallas", "TX"],
|
22
|
|
- ["Joe James", "Test Corp", "Yonkers", "NY"],
|
23
|
|
- ["John Walsh", "Test Corp", "Hartford", "CT"],
|
24
|
|
- ["Bob Herm", "Test Corp", "Tampa", "FL"],
|
25
|
|
- ["James Houston", "Test Corp", "Dallas", "TX"],
|
26
|
|
- ];
|
|
15
|
+ const auth = useAuth();
|
|
16
|
+ const token = React.useRef(auth.getToken())
|
|
17
|
+
|
|
18
|
+ const getAllPwd = async () => {
|
|
19
|
+ let rest = new Service('/contrasenia/getallbyidUsr');
|
|
20
|
+ return await rest.getQuery(token.current)
|
|
21
|
+ }
|
|
22
|
+
|
|
23
|
+ const { data : { data : result} } = useQuery('passwords', getAllPwd );
|
27
|
24
|
|
28
|
25
|
const options = {
|
29
|
26
|
filterType: 'checkbox',
|
|
@@ -45,8 +42,8 @@ export function Contrasv2() {
|
45
|
42
|
<MUIDataTable
|
46
|
43
|
sx={{ '& MuiPaper': { elevation: 0, boxShadow: 'none', color: "red" } }}
|
47
|
44
|
title={"Contraseñas"}
|
48
|
|
- data={data}
|
49
|
|
- columns={columns}
|
|
45
|
+ data={Build(result)}
|
|
46
|
+ columns={Encabezados}
|
50
|
47
|
options={options}
|
51
|
48
|
/>
|
52
|
49
|
</ThemeProvider>
|