Przeglądaj źródła

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

Yuki Takei 8 lat temu
rodzic
commit
29d217dba5
1 zmienionych plików z 6 dodań i 0 usunięć
  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() {
   componentDidMount() {
+    // if guest user
+    if (this.props.crowi.me === "") {
+      // do nothing
+      return;
+    }
+
     this.props.crowi.apiGet('/bookmarks.get', {page_id: this.props.pageId})
     this.props.crowi.apiGet('/bookmarks.get', {page_id: this.props.pageId})
     .then(res => {
     .then(res => {
       if (res.bookmark) {
       if (res.bookmark) {