Skip to content

Commit dbe8655

Browse files
committed
improve user asset data fetch
1 parent b97d31b commit dbe8655

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

source/action/user.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const getUserInfo = createAction(
4646
export const getUserAssetByCategory = createAction(
4747
types.FETCH_USER_ASSET,
4848
async(category, params)=> {
49-
params.pageIndex = 0;
49+
params.pageIndex = 1;
5050
return await userService.getUserAsset(category, params);
5151
},
5252
(category)=> {

source/component/router.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ class Router {
214214

215215
toUserAsset(props) {
216216
this.push({
217-
component: View.UserPost,
218-
name: 'userPost',
217+
component: View.UserAsset,
218+
name: 'userAsset',
219219
sceneConfig: RouterSceneConfig.customPushFromRight
220220
}, props);
221221
}

source/config/api.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ export default {
4545
user: {
4646
info: "api/Users",
4747
auth: "token",
48-
49-
blog: "api/blogs/<%=blogger%>/posts?pageIndex=<%=pageIndex%>",
50-
blink: "api/statuses/@<%=type%>?pageIndex=<%=pageIndex%>&pageSize=<%=pageSize%>&tag=<%=tag%>",
48+
home: "api/blogs/<%=blogger%>/posts?pageIndex=<%=pageIndex%>",
49+
blink: "api/statuses/@my?pageIndex=<%=pageIndex%>&pageSize=<%=pageSize%>",
5150
question: "api/questions/@myquestion?pageIndex=<%=pageIndex%>&pageSize=<%=pageSize%>",
5251
favorite: "api/Bookmarks?pageIndex=<%=pageIndex%>&pageSize=<%=pageSize%>"
5352
}

source/service/userService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as requestService from './request';
44
import * as Util from '../common';
55
import { Base64 } from '../common/base64';
66
import * as storageService from './storage';
7-
import { authData, storageKey } from '../config';
7+
import { authData, storageKey, pageSize } from '../config';
88
import dataApi from '../config/api';
99

1010
export function login(username, password){

source/view/userAsset.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
Text,
66
Image,
77
StyleSheet,
8+
RefreshControl,
89
TouchableHighlight,
910
TouchableOpacity
1011
} from 'react-native';
@@ -36,7 +37,7 @@ class UserAssetPage extends Component {
3637
}
3738

3839
componentDidMount(){
39-
const { userAction, category } = this.props;
40+
const { userAction, user, category } = this.props;
4041
userAction.getUserAssetByCategory(category, {
4142
blogger: user.BlogApp,
4243
});
@@ -69,7 +70,7 @@ class UserAssetPage extends Component {
6970
}
7071

7172
renderContentList(){
72-
let { category } = this.props;
73+
let { category, router } = this.props;
7374
if(category === postCategory.blink){
7475
return <UserBlinkList router={ router }/>;
7576
}
@@ -83,7 +84,7 @@ class UserAssetPage extends Component {
8384
}
8485

8586
renderContent(){
86-
const { category, router } = this.props;
87+
const { category, router, ui, assets } = this.props;
8788

8889
if(this.state.hasFocus === false || ui.refreshPending !== false){
8990
return (

0 commit comments

Comments
 (0)