import React, { Component } from "react";
import CommonLists from "./common_lists"
class FanUsers extends Component {
  componentDidMount=()=>{
    this.updateDocumentTitle();
  }

  componentDidUpdate(){
    this.updateDocumentTitle();
  }

  // 更新网页标题
  updateDocumentTitle(){
    const {user, current_user} = this.props;
    if(user && current_user){
      const {username, login} = user;
      const title_type =login === current_user.login ? "我" : "TA";
      document.title = `关注${title_type}的-${username}`
    }
  }

  render() {
    const {user, current_user , match, fetchUser} = this.props
    return (
      <div>
        {user && user.login &&  <CommonLists userType="fan_users" login={user.login} current_user={current_user} match={match} fetchUser={fetchUser}/>}
      </div>
    );
  }
}
export default FanUsers;
