Rev 2470 | Rev 2472 | 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'><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 notification-container"><ul>{notifications.length? notifications.map((element, i) => (<li key={i}><divclassName="row w-100"><divclassName="col-md-6 col-sm-12"><a href={element.link}>{element.message}</a></div><divclassName="col-md-6 col-sm-12 text-right w-100"><span className="w-100 text-right"> {element.time_elapsed} </span></div></div></li>)):<divclassName="section_admin_title_buttons w-100"style={{ display: 'grid', placeItems: 'center' }}><h1 className="title">{title}</h1></div>}</ul></div></div></div></div></section >)}export default Notifications