Authored by shixiang

添加是否收藏判断 review 草莓

... ... @@ -358,3 +358,25 @@ export function cancelFavorite() {
});
};
}
export function getFavoriteState() {
return (dispatch, getState) => {
let {app, detail} = getState();
let {brandId} = detail;
ReactNative.NativeModules.YH_CommonHelper.uid()
.then(uid => {
return new DetailService(app.host).isFavorite(brandId, uid)
.then(json => {
if (json) {
}
})
.catch(error => {
});
})
.catch(error => {
});
};
}
... ...
... ... @@ -116,5 +116,22 @@ export default class DetailService {
throw(error);
});
}
async isFavorite(id, uid, type='brand') {
return await this.api.get({
url: '',
body: {
method: 'app.favorite.isFavorite',
id,
uid,
type,
}
})
.then((json) => {
return json;
})
.catch((error) => {
throw(error);
});
}
}
... ...