Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 2781 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 2781 Rev 3719
Línea 1... Línea 1...
1
import React, { useEffect, useState } from 'react'
1
import React, { useEffect, useState } from 'react';
2
import { useDispatch } from 'react-redux'
2
import { useDispatch } from 'react-redux';
3
 
3
 
4
import { axios } from 'utils/index'
4
import { axios } from '@utils/index.js';
5
import { addNotification } from '@app/redux/notification/notification.actions'
5
import { addNotification } from '@app/redux/notification/notification.actions';
6
 
6
 
7
import Table from '@components/table/Table'
7
import Table from '@components/table/Table';
8
 
8
 
9
const BrowserTableColumns = [
9
const BrowserTableColumns = [
10
  {
10
  {
11
    field: 'platform',
11
    field: 'platform',
12
    headerName: 'Plataforma'
12
    headerName: 'Plataforma'
13
  },
13
  },
14
  {
14
  {
15
    field: 'browser',
15
    field: 'browser',
16
    headerName: 'Navegadores'
16
    headerName: 'Navegadores'
17
  },
17
  },
18
  {
18
  {
19
    field: 'device_type',
19
    field: 'device_type',
20
    headerName: 'Tipo'
20
    headerName: 'Tipo'
21
  },
21
  },
22
  {
22
  {
23
    field: 'version',
23
    field: 'version',
24
    headerName: 'Versión'
24
    headerName: 'Versión'
25
  },
25
  },
26
  {
26
  {
27
    field: 'updated_on',
27
    field: 'updated_on',
28
    headerName: 'Fecha'
28
    headerName: 'Fecha'
29
  }
29
  }
30
]
30
];
31
 
31
 
32
const Browsers = () => {
32
const Browsers = () => {
33
  const [browserData, setBrowserData] = useState({})
33
  const [browserData, setBrowserData] = useState({});
34
  const dispatch = useDispatch()
34
  const dispatch = useDispatch();
35
 
35
 
36
  const getBrowserData = () => {
36
  const getBrowserData = () => {
37
    axios
37
    axios
38
      .get('/account-settings/browsers')
38
      .get('/account-settings/browsers')
39
      .then((response) => {
39
      .then((response) => {
40
        const { data } = response.data
40
        const { data } = response.data;
41
        setBrowserData(data)
41
        setBrowserData(data);
42
      })
42
      })
43
      .catch((err) => {
43
      .catch((err) => {
44
        dispatch(addNotification({ style: 'danger', msg: err.message }))
44
        dispatch(addNotification({ style: 'danger', msg: err.message }));
45
      })
45
      });
46
  }
46
  };
47
 
47
 
48
  useEffect(() => {
48
  useEffect(() => {
49
    getBrowserData()
49
    getBrowserData();
50
  }, [])
50
  }, []);
51
 
51
 
52
  return (
52
  return (
53
    <div className='acc-setting'>
53
    <div className='acc-setting'>
54
      <h3>Navegadores</h3>
54
      <h3>Navegadores</h3>
55
      <div className='cp-field mb-3'>
55
      <div className='cp-field mb-3'>
56
        <Table columns={BrowserTableColumns} rows={browserData.items} />
56
        <Table columns={BrowserTableColumns} rows={browserData.items} />
57
      </div>
57
      </div>
58
    </div>
58
    </div>
59
  )
59
  );
60
}
60
};
61
 
61
 
62
export default Browsers
62
export default Browsers;