Rev 2476 | Rev 3197 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
import React from 'react';import { useState } from 'react';import { useLayoutEffect } from 'react';import ProfileInfo from '../dashboard/components/home-section/ProfileInfo';import SocialNetworks from '../dashboard/components/home-section/SocialNetworks';import { axios } from '../utils';const Notifications = ({ backendVars }) => {const { image, fullName, country, visits, connections, description } = backendVarsconst [notifications, setNotifications] = useState([]);const handleNotifications = async () => {try {const _notifications = await axios.get('/notifications');setNotifications(_notifications.data.data)console.log('>>: _notifications ', notifications)} catch (error) {console.log('>>: error > ', error)}}useLayoutEffect(() => {handleNotifications();}, []);return (<section className="notifications-page"><div className="card notifications-grid"><div className='main-left-sidebar' style={{ marginTop: '1.25rem' }}><ProfileInfoimage={image}fullName={fullName}description={description}visits={visits}country={country}connections={connections}/><SocialNetworks /></div><div className="card-body"><div className="container"><h2className="card-title"style={{ fontSize: '1.7rem', fontWeight: '700' }}>Notificaciones</h2><div className="messages-sec border-gray px-5 py-4"><ul>{notifications.length? notifications.map((element, i) => (<li key={i}><div className="notification-item"><a href={element.link}>{element.message}</a><span>{element.time_elapsed}</span></div></li>)):<divclassName="section_admin_title_buttons w-100"style={{ display: 'grid', placeItems: 'center' }}><h1 className="title">No hay notificaciones</h1></div>}</ul></div></div></div></div></section >)}export default Notifications