diff options
author | Noah Loomans <noahloomans@gmail.com> | 2017-01-30 17:56:25 +0100 |
---|---|---|
committer | Noah Loomans <noahloomans@gmail.com> | 2017-01-30 17:56:25 +0100 |
commit | 344504782ac628b15229cafada34a9f32d595624 (patch) | |
tree | 532293fef971164b21e3227955ff532668f850a1 /public/javascripts/schedule.js | |
parent | 29ea424009be3bd8561e74587b651c1c44bf2f7e (diff) | |
parent | 25fbba2084a23fb62ab0e7fdf2dd47eadc28a967 (diff) |
Merge branch 'update-url' into beta
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 |