diff options
author | Noah Loomans <noahloomans@gmail.com> | 2017-01-30 14:04:20 +0100 |
---|---|---|
committer | Noah Loomans <noahloomans@gmail.com> | 2017-01-30 14:04:20 +0100 |
commit | 25fbba2084a23fb62ab0e7fdf2dd47eadc28a967 (patch) | |
tree | 532293fef971164b21e3227955ff532668f850a1 /public/javascripts/schedule.js | |
parent | acbdba98a7ab37e76c856cc751b78e2a974036b9 (diff) |
Fix bugs in url update
- Document title doesn't update
- Page crashes when going back to front page
Diffstat (limited to 'public/javascripts/schedule.js')
-rw-r--r-- | public/javascripts/schedule.js | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/public/javascripts/schedule.js b/public/javascripts/schedule.js index a1ca647..a8e13c8 100644 --- a/public/javascripts/schedule.js +++ b/public/javascripts/schedule.js @@ -55,17 +55,22 @@ self._removeChilds = function () { } self.viewItem = function (week, selectedUser) { - const url = self._getURLOfUsers(week, selectedUser.type, selectedUser.index) + if (selectedUser == null) { + self._removeChilds() + search.updateDom(selectedUser) + } else { + const url = self._getURLOfUsers(week, selectedUser.type, selectedUser.index) - self._removeChilds() + self._removeChilds() - const request = new window.XMLHttpRequest() - request.addEventListener('load', self._handleLoad) - request.addEventListener('error', self._handleError) - request.open('GET', url, true) - request.send() + const request = new window.XMLHttpRequest() + request.addEventListener('load', self._handleLoad) + request.addEventListener('error', self._handleError) + request.open('GET', url, true) + request.send() - search.updateDom(selectedUser) + search.updateDom(selectedUser) + } } module.exports = self |