Toggle navigation
Toggle navigation
This project
Loading...
Sign in
이준성
/
khuwitch
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
ijunseong
2020-12-08 23:32:30 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a8154555a9938b23c8c9c70a28b900592c4413fa
a8154555
1 parent
bd01a3cb
Update: fetch channel info from server
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
3 deletions
frontend/src/Channel.js
frontend/src/Channel.js
View file @
a815455
...
...
@@ -117,7 +117,29 @@ export class ChannelList extends React.Component {
componentDidMount
()
{
console
.
log
(
'channel cdm'
);
fetch
(
'http://localhost:3303/list'
).
then
(
res
=>
res
.
json
())
fetch
(
'http://localhost:3303/channels'
).
then
(
res
=>
res
.
json
())
.
then
(
data
=>
{
var
tmpChannels
=
[];
data
.
map
((
channel
,
index
)
=>
{
var
tmp
=
{
id
:
channel
.
display_name
||
" "
,
nickname
:
channel
.
name
||
" "
,
category
:
channel
.
game
||
"Not playing"
,
view
:
channel
.
views
||
0
,
url
:
channel
.
url
||
"https://www.twitch.tv/"
,
isPlay
:
false
,
}
tmpChannels
.
push
(
tmp
);
})
return
tmpChannels
;
}).
then
(
channels
=>
{
this
.
setState
({
channels
:
channels
,
xisPlaying
:
null
,
})
})
}
/* fetch('http://localhost:3303/list').then( res => res.json())
.then(data => {
var tmpChannels = []
data.channels.map((channel, index) => {
...
...
@@ -138,8 +160,10 @@ export class ChannelList extends React.Component {
channels: channels,
xisPlaying: null,
})
})
}
}) */
render
()
{
return
(
...
...
Please
register
or
login
to post a comment