Преглед изворни кода

Merge pull request #180 from crowi/fix-error-on-search-page

Fix "can not read property" error on search page
Sotaro KARASAWA пре 9 година
родитељ
комит
b6b2cae2ee
1 измењених фајлова са 4 додато и 1 уклоњено
  1. 4 1
      resource/js/app.js

+ 4 - 1
resource/js/app.js

@@ -16,7 +16,10 @@ if (!window) {
 }
 
 const mainContent = document.querySelector('#content-main');
-const pageId = mainContent.attributes['data-page-id'].value || null;
+let pageId = null;
+if (mainContent !== null) {
+  pageId = mainContent.attributes['data-page-id'].value;
+}
 
 // FIXME
 const crowi = new Crowi({me: $('#content-main').data('current-username')}, window);