|
|
@@ -153,18 +153,27 @@ export default class PageContainer extends Container {
|
|
|
isLiked: like.data.isLiked,
|
|
|
});
|
|
|
|
|
|
- this.setBookmarkInfo();
|
|
|
+ this.retrieveBookmarkInfo();
|
|
|
this.checkAndUpdateImageUrlCached(this.state.likerUsers);
|
|
|
}
|
|
|
|
|
|
- async setBookmarkInfo() {
|
|
|
+ async retrieveBookmarkInfo() {
|
|
|
const response = await this.appContainer.apiv3Get('/bookmarks', { pageId: this.state.pageId });
|
|
|
- if (response.data.isBookmark != null) {
|
|
|
+ if (response.data.isBookmarked != null) {
|
|
|
this.setState({ isBookmarked: true });
|
|
|
}
|
|
|
+ else {
|
|
|
+ this.setState({ isBookmarked: false });
|
|
|
+ }
|
|
|
this.setState({ sumOfBookmarks: response.data.sumOfBookmarks });
|
|
|
}
|
|
|
|
|
|
+ async updateBookmark() {
|
|
|
+ const bool = !this.state.isBookmarked;
|
|
|
+ await this.appContainer.apiv3Put('/bookmarks', { pageId: this.state.pageId, bool });
|
|
|
+ this.retrieveBookmarkInfo();
|
|
|
+ }
|
|
|
+
|
|
|
async checkAndUpdateImageUrlCached(users) {
|
|
|
const noImageCacheUsers = users.filter((user) => { return user.imageUrlCached == null });
|
|
|
if (noImageCacheUsers.length === 0) {
|