소스 검색

ensure not to process componentDidMount of BookmarkButton if crowi.me is empty

Yuki Takei 9 년 전
부모
커밋
29d217dba5
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      resource/js/components/BookmarkButton.js

+ 6 - 0
resource/js/components/BookmarkButton.js

@@ -16,6 +16,12 @@ export default class BookmarkButton extends React.Component {
   }
 
   componentDidMount() {
+    // if guest user
+    if (this.props.crowi.me === "") {
+      // do nothing
+      return;
+    }
+
     this.props.crowi.apiGet('/bookmarks.get', {page_id: this.props.pageId})
     .then(res => {
       if (res.bookmark) {