import React , { Component } from 'react'; import { Link , Route , Switch } from 'react-router-dom'; import '../css/index.css' import './list.css'; import Loadable from 'react-loadable'; import Loading from '../../Loading'; import axios from 'axios'; const FileNew = Loadable({ loader: () => import('../Newfile/Index'), loading: Loading, }) const OrderIndex = Loadable({ loader: () => import('../Order/order'), loading: Loading, }) const CoderRootIndex = Loadable({ loader: () => import('./CoderRootIndex'), loading: Loading, }) class Detail extends Component{ constructor(props){ super(props); this.state={ projectDetail:undefined } } componentDidMount=()=>{ this.getDetail(); } getDetail=()=>{ const { login } = this.props.current_user; const { projectsId } = this.props.match.params; const url = `/${login}/${projectsId}.json`; axios.get(url).then((result)=>{ if(result){ this.setState({ projectDetail:result.data }) } }).catch((error)=>{}) } render(){ const { projectsId } = this.props.match.params; const { projectDetail } = this.state; const url = this.props.history.location.pathname; return(
{projectDetail && projectDetail.author && projectDetail.author.name} / { projectDetail && projectDetail.identifier }
{projectDetail && projectDetail.watchers_count} {projectDetail && projectDetail.praises_count} {projectDetail && projectDetail.forked_count}