solve the bug
parent
2bade8434f
commit
4d91e63dcb
|
|
@ -260,8 +260,7 @@ const Notification = ({ setRedirect, setRedirectUrl, t }) => {
|
|||
},
|
||||
body: JSON.stringify({
|
||||
"data": {
|
||||
"status": '' +
|
||||
'',
|
||||
"status": 'acknowledged',
|
||||
"reply": 'ok'
|
||||
}
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -1,46 +1,27 @@
|
|||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import classNames from 'classnames';
|
||||
import React, {useEffect, useState} from 'react';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Card, Dropdown, DropdownMenu, DropdownToggle } from 'reactstrap';
|
||||
import ListGroup from 'reactstrap/es/ListGroup';
|
||||
import ListGroupItem from 'reactstrap/es/ListGroupItem';
|
||||
// import { rawEarlierNotifications, rawNewNotifications } from '../../data/notification/notification';
|
||||
import {getCookieValue, isIterableArray} from '../../helpers/utils';
|
||||
import { rawEarlierNotifications, rawNewNotifications } from '../../data/notification/notification';
|
||||
import { isIterableArray } from '../../helpers/utils';
|
||||
import useFakeFetch from '../../hooks/useFakeFetch';
|
||||
import FalconCardHeader from '../common/FalconCardHeader';
|
||||
import Notification from '../notification/Notification';
|
||||
import { withTranslation } from 'react-i18next';
|
||||
import {APIBaseURL} from "../../config";
|
||||
import {createCookie , getPaginationArray} from '../../helpers/utils';
|
||||
import { APIBaseURL } from "../../config";
|
||||
import moment from 'moment';
|
||||
import createMarkup from '../../helpers/createMarkup';
|
||||
import {toast} from "react-toastify";
|
||||
import {notifications} from "../../data/notification/notification";
|
||||
import { toast } from "react-toastify";
|
||||
import { getCookieValue } from '../../helpers/utils';
|
||||
|
||||
const NotificationDropdown = ({ setRedirect, setRedirectUrl,t }) => {
|
||||
let current_moment = moment();
|
||||
useEffect(() => {
|
||||
let is_logged_in = getCookieValue('is_logged_in');
|
||||
let user_name = getCookieValue('user_name');
|
||||
let user_display_name = getCookieValue('user_display_name');
|
||||
let user_uuid = getCookieValue('user_uuid');
|
||||
let token = getCookieValue('token');
|
||||
if ((is_logged_in === null || !is_logged_in)) {
|
||||
setRedirectUrl(`/authentication/basic/login`);
|
||||
setRedirect(true);
|
||||
} else {
|
||||
// update expires time of cookies
|
||||
createCookie('is_logged_in', true, 1000 * 60 * 60 * 8);
|
||||
createCookie('user_name', user_name, 1000 * 60 * 60 * 8);
|
||||
createCookie('user_display_name', user_display_name, 1000 * 60 * 60 * 8);
|
||||
createCookie('user_uuid', user_uuid, 1000 * 60 * 60 * 8);
|
||||
createCookie('token', token, 1000 * 60 * 60 * 8);
|
||||
}
|
||||
});
|
||||
const NotificationDropdown = ({ t }) => {
|
||||
// State
|
||||
const [rawNewNotificationschild, setRawNewNotificationschild] = useState([]);
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const [isAllRead, setIsAllRead] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
let isResponseOK = false;
|
||||
fetch(APIBaseURL + '/webmessagesnew', {
|
||||
|
|
@ -93,6 +74,7 @@ const NotificationDropdown = ({ setRedirect, setRedirectUrl,t }) => {
|
|||
console.log("test");
|
||||
console.log(rawNewNotificationschild);
|
||||
|
||||
|
||||
// Handler
|
||||
const handleToggle = e => {
|
||||
e.preventDefault();
|
||||
|
|
@ -137,6 +119,7 @@ const NotificationDropdown = ({ setRedirect, setRedirectUrl,t }) => {
|
|||
});
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<Dropdown
|
||||
nav
|
||||
|
|
@ -168,20 +151,14 @@ const NotificationDropdown = ({ setRedirect, setRedirectUrl,t }) => {
|
|||
</Link>
|
||||
</FalconCardHeader>
|
||||
<ListGroup flush className="font-weight-normal fs--1">
|
||||
<div className="list-group-title" >{t('notification_NEW')}</div>
|
||||
<div className="list-group-title">{t('notification_NEW')}</div>
|
||||
{isIterableArray(rawNewNotificationschild) &&
|
||||
rawNewNotificationschild.map((notification, index) => (
|
||||
<ListGroupItem to="/notification" key={index} onClick={handleToggle}>
|
||||
<ListGroupItem key={index} onClick={handleToggle}>
|
||||
<Notification {...notification} flush />
|
||||
</ListGroupItem>
|
||||
))}
|
||||
{/*<div className="list-group-title">{t('notification_EARLIER')}</div>*/}
|
||||
{/*{isIterableArray(rawNewNotificationschild) &&*/}
|
||||
{/* rawNewNotificationschild.map((notification, index) => (*/}
|
||||
{/* <ListGroupItem key={index} onClick={handleToggle}>*/}
|
||||
{/* <Notification {...notification} flush />*/}
|
||||
{/* </ListGroupItem>*/}
|
||||
{/* ))}*/}
|
||||
|
||||
</ListGroup>
|
||||
<div className="card-footer text-center border-top-0" onClick={handleToggle}>
|
||||
<Link className="card-link d-block" to="/notification">
|
||||
|
|
|
|||
Loading…
Reference in New Issue