Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 2611 | Rev 3198 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 2611 Rev 3197
Línea 1... Línea 1...
1
import React from 'react';
1
import React from 'react';
2
import { useState } from 'react';
2
import { useState } from 'react';
3
import { useLayoutEffect } from 'react';
3
import { useLayoutEffect } from 'react';
-
 
4
import { useDispatch } from 'react-redux';
4
import ProfileInfo from '../dashboard/components/home-section/ProfileInfo';
5
import ProfileInfo from '../dashboard/components/home-section/ProfileInfo';
5
import SocialNetworks from '../dashboard/components/home-section/SocialNetworks';
6
import SocialNetworks from '../dashboard/components/home-section/SocialNetworks';
-
 
7
import { addNotification } from '../redux/notification/notification.actions';
6
import { axios } from '../utils';
8
import { axios } from '../utils';
Línea 7... Línea 9...
7
 
9
 
Línea 8... Línea 10...
8
const Notifications = ({ backendVars }) => {
10
const Notifications = ({ backendVars }) => {
9
 
11
 
-
 
12
  const { image, fullName, country, visits, connections, description } = backendVars
Línea 10... Línea 13...
10
  const { image, fullName, country, visits, connections, description } = backendVars
13
  const [notifications, setNotifications] = useState([]);
11
  const [notifications, setNotifications] = useState([]);
14
  const dispatch = useDispatch()
12
 
15
 
13
  const handleNotifications = async () => {
16
  const handleNotifications = async () => {
Línea 18... Línea 21...
18
    } catch (error) {
21
    } catch (error) {
19
      console.log('>>: error > ', error)
22
      console.log('>>: error > ', error)
20
    }
23
    }
21
  }
24
  }
Línea -... Línea 25...
-
 
25
 
-
 
26
  const markReadNotifications = () => {
-
 
27
    axios.post('/notifications/markRead')
-
 
28
      .then(({ data }) => data.success)
-
 
29
      .catch(err => {
-
 
30
        dispatch(addNotification({
-
 
31
          style: "error",
-
 
32
          msg: 'Disculpe, ha ocurrido un error marcando notificaciones como leidas',
-
 
33
        }))
-
 
34
        console.log('>>: err > ', err)
-
 
35
      })
-
 
36
  }
22
 
37
 
23
  useLayoutEffect(() => {
38
  useLayoutEffect(() => {
24
    handleNotifications();
39
    handleNotifications();
Línea 25... Línea 40...
25
  }, []);
40
  }, []);