'use strict'; import React from 'react'; import { Menu } from 'antd'; import { Link } from 'react-router-dom'; import { connect } from 'react-redux'; import CryptoJS from 'crypto-js'; import styles from './style.css'; import { MenuFoldOutlined, MenuUnfoldOutlined, UserOutlined, LogoutOutlined } from '@ant-design/icons'; import ResetPasswordModal from '../../../sections/memberManagement/components/resetPassword'; const Header = props => { const { dispatch, history, user, pathname, toggleCollapsed, collapsed, actions } = props const onFinish = async (values) => { const secretKey = "freesun"; const dataToSave = { ...values, oldpassword: CryptoJS.AES.encrypt(values.oldpassword, secretKey).toString(), password: CryptoJS.AES.encrypt(values.password, secretKey).toString(), } return dispatch( actions.memberManagement.modifyUser(user.id, dataToSave, values?.msg || ''), ).then((res) => { if (res.success) { return true; } else { return false; } }); }; const handelClick = item => { if (item.key == 'logout') { dispatch(actions.auth.logout(user)); history.push(`/signin`); } } let current = pathname; if (pathname == '/' || pathname == '') { current = 'default'; } else if (pathname.charAt(0) == '/') { current = pathname.substring(1); } if (current.indexOf('/') != -1) { current = current.substring(0, current.indexOf('/')); } return (