Просмотр исходного кода

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

Yuki Takei 8 лет назад
Родитель
Сommit
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) {