import React, {Component} from 'react'; import {History, LocationState} from 'history'; import SecondLogin from './index'; import Spinner from '../../ui/spinner' import styles from '../index.css'; import routes from '../../../constants/routes.json'; type MyComponentProps = { history: History; auth: any; getUsers: (id: number) => void; users: any; logoutStore: (callback: () => void) => void; }; class ShowUsers extends Component{ componentDidMount() { const { auth, getUsers } = this.props; if(auth.authenticateStore) { getUsers(auth.authenticateStore.UsersId); } } navigate(user: any) { const { history } = this.props; setTimeout(() => { history.push(`/login/users/${user.PharmacyUsersId}`) } , 200); } renderUsers = () => { if(this.props.users.users) { return ( <> { this.props.users.users.map((user:any) => { return(
this.navigate(user)} >
{user.UserName}
) }) }
Logout
); } return ; }; logout = () => { this.props.logoutStore(() => { this.props.history.push(routes.STORE_LOGIN); }) }; render(){ return ( {this.renderUsers()} ) } } export default ShowUsers;