Yuki Takei 8 лет назад
Родитель
Сommit
2ae7b87828
1 измененных файлов с 6 добавлено и 2 удалено
  1. 6 2
      resource/js/components/BookmarkButton.js

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

@@ -17,7 +17,7 @@ export default class BookmarkButton extends React.Component {
 
   componentDidMount() {
     // if guest user
-    if (this.props.crowi.me === "") {
+    if (!this.isUserLoggedIn()) {
       // do nothing
       return;
     }
@@ -56,9 +56,13 @@ export default class BookmarkButton extends React.Component {
     this.setState({bookmarked: false});
   }
 
+  isUserLoggedIn() {
+    return this.props.crowi.me !== '';
+  }
+
   render() {
     // if guest user
-    if (this.props.crowi.me === "") {
+    if (!this.isUserLoggedIn()) {
       return <div></div>;
     }