cache changes
This commit is contained in:
parent
57f96abd0c
commit
3e194d0b1b
2 changed files with 6 additions and 4 deletions
|
@ -78,7 +78,7 @@ function parsePost(post) {
|
||||||
function getPost(id) {
|
function getPost(id) {
|
||||||
for (let i = 0; i < data.posts.length; i++) {
|
for (let i = 0; i < data.posts.length; i++) {
|
||||||
if (data.posts[i].id === id) {
|
if (data.posts[i].id === id) {
|
||||||
return i
|
return id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1
|
return -1
|
||||||
|
@ -90,7 +90,7 @@ async function like(span) {
|
||||||
const current = post.likes[data.user.id]
|
const current = post.likes[data.user.id]
|
||||||
const response = await postlike(id, !current)
|
const response = await postlike(id, !current)
|
||||||
if (response.status != 200) return;
|
if (response.status != 200) return;
|
||||||
post.likes[data.user.id] = !current
|
post.likes[data.user.id] = !currentg
|
||||||
render()
|
render()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,8 @@ const register = (first, last, email, password, gender, month, day, year) => {
|
||||||
}
|
}
|
||||||
newest_user = data.user.id
|
newest_user = data.user.id
|
||||||
session_links[data.key] = 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
|
users[data.user.id] = data.user
|
||||||
return data.key
|
return data.key
|
||||||
}
|
}
|
||||||
|
@ -104,8 +106,8 @@ const login = (email, pass) => {
|
||||||
|
|
||||||
const logout = (token) => {
|
const logout = (token) => {
|
||||||
|
|
||||||
if (session_links[token] === NO_VALUE) {
|
if (session_links[token] === NO_VALUE || session_links[token] === NO_CACHE) {
|
||||||
return false
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!database.deleteSession(token)) {
|
if (!database.deleteSession(token)) {
|
||||||
|
|
Loading…
Reference in a new issue