ijunseong

Update: /list api

......@@ -68,7 +68,7 @@ export class ChannelList extends React.Component {
]
this.state = {
channels: test,
channels: [],
xisPlaying: null,
}
}
......@@ -118,8 +118,27 @@ export class ChannelList extends React.Component {
componentDidMount() {
console.log('channel cdm');
fetch('http://localhost:3303/list').then( res => res.json())
.then(data => console.log(data))
// 수신 테스트
.then(data => {
var tmpChannels = []
data.channels.map((channel, index) => {
var tmp = {
id: channel.id,
nickname: channel.nickname,
category: channel.category,
view: channel.view,
url: `https://www.twitch.tv/${channel.id}`,
isPlay: false,
}
tmpChannels.push(tmp);
})
return tmpChannels;
}).then( channels => {
this.setState({
channels: channels,
xisPlaying: null,
})
})
}
render() {
......