修改个人中心我的帖子接口传参。 code review by 于良
Showing
3 changed files
with
9 additions
and
6 deletions
1 | -'use strict' | 1 | + 'use strict' |
2 | 2 | ||
3 | import ReactNative from 'react-native'; | 3 | import ReactNative from 'react-native'; |
4 | import {Actions} from 'react-native-router-flux'; | 4 | import {Actions} from 'react-native-router-flux'; |
@@ -181,12 +181,13 @@ export function posts(ptr = false) { | @@ -181,12 +181,13 @@ export function posts(ptr = false) { | ||
181 | 181 | ||
182 | dispatch(postRequest(ptr)); | 182 | dispatch(postRequest(ptr)); |
183 | let uid = user.profile.uid; | 183 | let uid = user.profile.uid; |
184 | + let loginUid = user.profile.uid; | ||
184 | let lastedTime = 0; | 185 | let lastedTime = 0; |
185 | if (!ptr) { | 186 | if (!ptr) { |
186 | lastedTime = user.posts.lastedTime; | 187 | lastedTime = user.posts.lastedTime; |
187 | } | 188 | } |
188 | let limit = LIMIT; | 189 | let limit = LIMIT; |
189 | - return new UserService().posts(uid, lastedTime, limit) | 190 | + return new UserService().posts(uid, loginUid, lastedTime, limit) |
190 | .then(json => { | 191 | .then(json => { |
191 | let payload = parseJson(json); | 192 | let payload = parseJson(json); |
192 | if (!ptr) { | 193 | if (!ptr) { |
@@ -101,7 +101,7 @@ export function tnmPostFailure(sid, error) { | @@ -101,7 +101,7 @@ export function tnmPostFailure(sid, error) { | ||
101 | 101 | ||
102 | export function userThatNotMePosts(sid) { | 102 | export function userThatNotMePosts(sid) { |
103 | return (dispatch, getState) => { | 103 | return (dispatch, getState) => { |
104 | - let {userThatNotMe} = getState(); | 104 | + let {user, userThatNotMe} = getState(); |
105 | let item = userThatNotMe.items.get(sid); | 105 | let item = userThatNotMe.items.get(sid); |
106 | if (item.posts.isFetching || item.posts.error) { | 106 | if (item.posts.isFetching || item.posts.error) { |
107 | return; | 107 | return; |
@@ -112,7 +112,8 @@ export function userThatNotMePosts(sid) { | @@ -112,7 +112,8 @@ export function userThatNotMePosts(sid) { | ||
112 | let uid = item.profile.uid; | 112 | let uid = item.profile.uid; |
113 | let lastedTime = item.posts.lastedTime; | 113 | let lastedTime = item.posts.lastedTime; |
114 | let limit = 10; | 114 | let limit = 10; |
115 | - return new UserService().posts(uid, lastedTime, limit) | 115 | + let loginUid = user.profile.uid; |
116 | + return new UserService().posts(uid,loginUid, lastedTime, limit) | ||
116 | .then(json => { | 117 | .then(json => { |
117 | let payload = parseUserThatNotMePosts(json); | 118 | let payload = parseUserThatNotMePosts(json); |
118 | let oldList = item.posts.list.toJS(); | 119 | let oldList = item.posts.list.toJS(); |
@@ -56,14 +56,15 @@ export default class UserService { | @@ -56,14 +56,15 @@ export default class UserService { | ||
56 | }); | 56 | }); |
57 | } | 57 | } |
58 | 58 | ||
59 | - async posts(uid, lastedTime, limit) { | 59 | + async posts(uid,loginUid, lastedTime, limit) { |
60 | return await this.api.get({ | 60 | return await this.api.get({ |
61 | url: '', | 61 | url: '', |
62 | body: { | 62 | body: { |
63 | method: 'app.social.getMyPostList', | 63 | method: 'app.social.getMyPostList', |
64 | uid, | 64 | uid, |
65 | lastedTime, | 65 | lastedTime, |
66 | - limit | 66 | + limit, |
67 | + loginUid | ||
67 | } | 68 | } |
68 | }) | 69 | }) |
69 | .then((json) => { | 70 | .then((json) => { |
-
Please register or login to post a comment