Skip to content
This repository has been archived by the owner on Dec 2, 2019. It is now read-only.

Commit

Permalink
fix channel
Browse files Browse the repository at this point in the history
  • Loading branch information
xwartz committed May 17, 2016
1 parent 2309f16 commit 2a8304f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "douban.fm",
"productName": "douban.fm",
"version": "1.0.1",
"version": "1.0.2",
"description": "豆瓣fm的桌面应用",
"main": "./main.js",
"author": "xwartz <[email protected]>",
Expand Down
Binary file modified dev.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 14 additions & 15 deletions src/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ const receiveNever = () => {
return { type: types.RECEIVE_NEVER }
}

export const postNever = (channelId, sid) => {
export const postNever = (channel, sid) => {
return (dispatch) => {
dispatch(never())

return operate('never_play_again', { channel_id: channelId, sid },
return operate('never_play_again', { channel, sid },
() => receiveNever())
}
}
Expand All @@ -38,30 +38,30 @@ const receiveLike = () => {
return { type: types.RECEIVE_LIKE }
}

export const postLike = (isLike, channelId, sid) => {
export const postLike = (isLike, channel, sid) => {
const method = isLike ? 'unstar' : 'star'
return (dispatch) => {
dispatch(like())

return operate(method, { channel_id: channelId, sid },
return operate(method, { channel, sid },
() => receiveLike())
}
}

// fetch more
const requestMoreSongs = (channelId, sid) => {
return { type: types.REQUEST_MORE, channel_id: channelId, sid }
const requestMoreSongs = (channel, sid) => {
return { type: types.REQUEST_MORE, channel, sid }
}

const receiveMoreSongs = (songs) => {
return { type: types.RECEIVE_MORE, songs }
}

export const fetchMoreSongs = (channelId, sid, cb) => {
export const fetchMoreSongs = (channel, sid, cb) => {
return (dispatch) => {
dispatch(requestMoreSongs(channelId, sid))
dispatch(requestMoreSongs(channel, sid))

return operate('songs', { channel_id: channelId, sid },
return operate('songs', { channel, sid },
(songs) => {
dispatch(receiveMoreSongs(songs))
cb && cb()
Expand All @@ -70,19 +70,19 @@ export const fetchMoreSongs = (channelId, sid, cb) => {
}

// fetch songs
const requestSongs = (channelId) => {
return { type: types.REQUEST_SONGS, channelId }
const requestSongs = (channel) => {
return { type: types.REQUEST_SONGS, channel }
}

const receiveSongs = (songs) => {
return { type: types.RECEIVE_SONGS, songs }
}

export const fetchSongs = (channelId) => {
export const fetchSongs = (channel) => {
return (dispatch) => {
dispatch(requestSongs(channelId))
dispatch(requestSongs(channel))

return operate('songs', { channel_id: channelId },
return operate('songs', { channel },
(songs) => dispatch(receiveSongs(songs)))
}
}
Expand Down Expand Up @@ -133,7 +133,6 @@ export const login = (opt) => {
return (dispatch) => {
dispatch(requestLogin())
return operate('login', opt, (data) => {
console.log(data)
if (data.body.r === 0) {
dispatch(receiveLogin(data.body.user_info))
dispatch(loginPop())
Expand Down

0 comments on commit 2a8304f

Please sign in to comment.