...
|
...
|
@@ -64,8 +64,6 @@ export function fetchUserFavArticleList() { |
|
|
}
|
|
|
return new MineGuangService(app.serviceHost).getUserFavArticleList(params)
|
|
|
.then(json => {
|
|
|
console.log('------mine guang');
|
|
|
console.log(json);
|
|
|
if (favArticleList && favArticleList.size) {
|
|
|
favArticleList = favArticleList.toJS();
|
|
|
}
|
...
|
...
|
@@ -75,8 +73,6 @@ export function fetchUserFavArticleList() { |
|
|
dispatch(fetchSimpleArticleList(json.data))
|
|
|
})
|
|
|
.catch(error => {
|
|
|
console.log('------error');
|
|
|
console.log(error);
|
|
|
dispatch(fetchUserFavArticleListFailure(error));
|
|
|
})
|
|
|
}
|
...
|
...
|
@@ -112,16 +108,10 @@ export function fetchSimpleArticleList(favArticleList) { |
|
|
return new MineGuangService(app.serviceHost).getSimpleArticleList(params)
|
|
|
.then(json => {
|
|
|
//将请求到的文章相关数据合并到favArticleList
|
|
|
console.log('------mine guang');
|
|
|
console.log(json);
|
|
|
let newFavArticleList = mergeSimpleArticleToFavList(favArticleList,json.artList);
|
|
|
console.log('------merged');
|
|
|
console.log(newFavArticleList);
|
|
|
dispatch(updateUserFavArticleList(newFavArticleList));
|
|
|
})
|
|
|
.catch(error => {
|
|
|
console.log('------error');
|
|
|
console.log(error);
|
|
|
})
|
|
|
}
|
|
|
|
...
|
...
|
@@ -157,28 +147,28 @@ function mergeSimpleArticleToFavList(favArticleList,simpleArticleList) { |
|
|
return favArticleList;
|
|
|
}
|
|
|
|
|
|
export function onPressLike(article_id, isLike) {
|
|
|
export function onPressLike(article_id,rowID) {
|
|
|
return (dispatch, getState) => {
|
|
|
let {app, mineGuang} = getState();
|
|
|
|
|
|
let likeRequest = (article_id, uid, isLike) => {
|
|
|
// dispatch(likeArticle({article_id, isLike}));
|
|
|
//
|
|
|
// if (isLike) {
|
|
|
// return new ListService(app.serviceHost).setArticleFavorite(article_id, uid)
|
|
|
// }else {
|
|
|
// return new ListService(app.serviceHost).cancleArticleFavorite(article_id, uid)
|
|
|
// }
|
|
|
let {userFavArticleList} = mineGuang;
|
|
|
let {favArticleList} = userFavArticleList;
|
|
|
let likeRequest = (article_id, uid) => {
|
|
|
if (!favArticleList || favArticleList.size == 0) {
|
|
|
return;
|
|
|
}
|
|
|
let newFavArticleList = favArticleList.delete(rowID);
|
|
|
dispatch(updateUserFavArticleList(newFavArticleList));
|
|
|
return new MineGuangService(app.serviceHost).cancelFavorite({article_id,uid});
|
|
|
}
|
|
|
|
|
|
ReactNative.NativeModules.YH_CommonHelper.uid()
|
|
|
.then(uid => {
|
|
|
likeRequest(article_id, uid, isLike);
|
|
|
likeRequest(article_id, uid);
|
|
|
})
|
|
|
.catch(error => {
|
|
|
ReactNative.NativeModules.YH_CommonHelper.login()
|
|
|
.then(uid => {
|
|
|
likeRequest(article_id, uid, isLike);
|
|
|
likeRequest(article_id, uid);
|
|
|
})
|
|
|
.catch(error => {
|
|
|
|
...
|
...
|
|