diff options
Diffstat (limited to 'juick-server/src/main/assets/scripts.js')
-rw-r--r-- | juick-server/src/main/assets/scripts.js | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/juick-server/src/main/assets/scripts.js b/juick-server/src/main/assets/scripts.js index 6b1176ee..772956b0 100644 --- a/juick-server/src/main/assets/scripts.js +++ b/juick-server/src/main/assets/scripts.js @@ -603,19 +603,26 @@ function addTag(tag) { return false; } +var users = {} + function fetchUserUri(dataUri, callback) { - let data = new FormData(); - data.append('uri', dataUri); - fetch('/u/', { - method: 'POST', - body: data - }).then(handleErrors) - .then(response => { - return response.json(); - }) - .then(json => { - callback(json); - }); + if (users[dataUri]) { + callback(users[dataUri]); + } else { + let data = new FormData(); + data.append('uri', dataUri); + fetch('/u/', { + method: 'POST', + body: data + }).then(handleErrors) + .then(response => { + return response.json(); + }) + .then(json => { + users[dataUri] = json; + callback(json); + }); + } } /******************************************************************************/ |