etrian-fallout / feapp-replay-module

PUBG Replay
https://feapp-replay-module.herokuapp.com/
MIT License
2 stars 1 forks source link

Replay 기능 #2

Closed yongjun823 closed 5 years ago

yongjun823 commented 5 years ago

match id 배열만 보여주는 부분에서 상세정보도 같이 보여주게 바꿈

  1. match id arr 받아옴
  2. id arr로 다시 info 요청

https://github.com/etrian-fallout/feapp-replay-module/blob/master/src/components/Pubg/Matchlist.js#L36

    const funcArr = tempArr.map(async x => {
      const url = request2 + x["id"] + "?platform=" + this.props.match.params.platform;
      const info = await fetch(url).then(res => res.json());

      return info;
    })

    const infoArr = await Promise.all(funcArr)

(수정한 코드)

https://github.com/etrian-fallout/feapp-replay-module/blob/master/src/components/Pubg/Matchlist.js#L63

<Link to={{
  pathname: `${this.props.location.pathname}/${item["id"]}`,
  state: {
    mapName: mapName,
    telemetryUrl: this.state.matchInfoList[idx]["included"][0]["attributes"]["url"]
  }
}}>
  <h2>{item["id"]}</h2>
</Link>

리플레이 보여줄때 맵 이름이랑 리플레이 json url 필요하여 location에 저장하여 전송