Showing
1 changed file
with
22 additions
and
3 deletions
... | @@ -68,7 +68,7 @@ export class ChannelList extends React.Component { | ... | @@ -68,7 +68,7 @@ export class ChannelList extends React.Component { |
68 | ] | 68 | ] |
69 | 69 | ||
70 | this.state = { | 70 | this.state = { |
71 | - channels: test, | 71 | + channels: [], |
72 | xisPlaying: null, | 72 | xisPlaying: null, |
73 | } | 73 | } |
74 | } | 74 | } |
... | @@ -118,8 +118,27 @@ export class ChannelList extends React.Component { | ... | @@ -118,8 +118,27 @@ export class ChannelList extends React.Component { |
118 | componentDidMount() { | 118 | componentDidMount() { |
119 | console.log('channel cdm'); | 119 | console.log('channel cdm'); |
120 | fetch('http://localhost:3303/list').then( res => res.json()) | 120 | fetch('http://localhost:3303/list').then( res => res.json()) |
121 | - .then(data => console.log(data)) | 121 | + .then(data => { |
122 | - // 수신 테스트 | 122 | + var tmpChannels = [] |
123 | + data.channels.map((channel, index) => { | ||
124 | + var tmp = { | ||
125 | + id: channel.id, | ||
126 | + nickname: channel.nickname, | ||
127 | + category: channel.category, | ||
128 | + view: channel.view, | ||
129 | + url: `https://www.twitch.tv/${channel.id}`, | ||
130 | + isPlay: false, | ||
131 | + } | ||
132 | + tmpChannels.push(tmp); | ||
133 | + }) | ||
134 | + | ||
135 | + return tmpChannels; | ||
136 | + }).then( channels => { | ||
137 | + this.setState({ | ||
138 | + channels: channels, | ||
139 | + xisPlaying: null, | ||
140 | + }) | ||
141 | + }) | ||
123 | } | 142 | } |
124 | 143 | ||
125 | render() { | 144 | render() { | ... | ... |
-
Please register or login to post a comment