diff options
author | Tyler Murphy <tylermurphy534@gmail.com> | 2023-01-24 15:06:20 -0500 |
---|---|---|
committer | Tyler Murphy <tylermurphy534@gmail.com> | 2023-01-24 15:06:20 -0500 |
commit | 3e194d0b1bd6254c31c2863fa6b8a253a7384b22 (patch) | |
tree | c1b3ff6a43e8aedbc848e18b089885a2e01289de | |
parent | like counter (diff) | |
download | xssbook-3e194d0b1bd6254c31c2863fa6b8a253a7384b22.tar.gz xssbook-3e194d0b1bd6254c31c2863fa6b8a253a7384b22.tar.bz2 xssbook-3e194d0b1bd6254c31c2863fa6b8a253a7384b22.zip |
cache changesoldjsver
-rw-r--r-- | public/js/home.js | 4 | ||||
-rw-r--r-- | src/cache.js | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/public/js/home.js b/public/js/home.js index c6f8a86..47d3e13 100644 --- a/public/js/home.js +++ b/public/js/home.js @@ -78,7 +78,7 @@ function parsePost(post) { function getPost(id) { for (let i = 0; i < data.posts.length; i++) { if (data.posts[i].id === id) { - return i + return id } } return -1 @@ -90,7 +90,7 @@ async function like(span) { const current = post.likes[data.user.id] const response = await postlike(id, !current) if (response.status != 200) return; - post.likes[data.user.id] = !current + post.likes[data.user.id] = !currentg render() } diff --git a/src/cache.js b/src/cache.js index fac8aa8..d6aa790 100644 --- a/src/cache.js +++ b/src/cache.js @@ -88,6 +88,8 @@ const register = (first, last, email, password, gender, month, day, year) => { } newest_user = data.user.id session_links[data.key] = data.user.id + password_links[data.user.password] = data.user.id + email_links[data.user.email] = data.id users[data.user.id] = data.user return data.key } @@ -104,8 +106,8 @@ const login = (email, pass) => { const logout = (token) => { - if (session_links[token] === NO_VALUE) { - return false + if (session_links[token] === NO_VALUE || session_links[token] === NO_CACHE) { + return true } if (!database.deleteSession(token)) { |