Compare commits
No commits in common. "c826b6b5dbe5829ea7c958c131660cbdef0587cc" and "5543b1e8c5398a8a63685950b5dfd2ce97d89c30" have entirely different histories.
c826b6b5db
...
5543b1e8c5
13
chat.js
13
chat.js
|
@ -21,12 +21,8 @@ form.addEventListener("submit", async function (event) {
|
||||||
if (matches.status === "ok") {
|
if (matches.status === "ok") {
|
||||||
sendMessage()
|
sendMessage()
|
||||||
} else {
|
} else {
|
||||||
const mismatch = 'Username and token mismatch. Try logging in again.'
|
document.querySelector("#errormessage").innerHTML = 'Username and token mismatch. Try logging in again.'
|
||||||
printText(mismatch.bold())
|
|
||||||
logout()
|
|
||||||
localStorage.removeItem('username')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
//SEND MESSAGE FETCH FUNCTION
|
//SEND MESSAGE FETCH FUNCTION
|
||||||
|
@ -91,10 +87,3 @@ loggedIn()
|
||||||
|
|
||||||
|
|
||||||
//REVIECE USERS PRONOUNS
|
//REVIECE USERS PRONOUNS
|
||||||
|
|
||||||
async function getPronouns() {
|
|
||||||
const response = await fetch(`api/users/${username}/`);
|
|
||||||
const data = await response.json();
|
|
||||||
pronouns = data.pronouns
|
|
||||||
return pronouns;
|
|
||||||
}
|
|
18
logout.js
18
logout.js
|
@ -20,13 +20,13 @@ async function logout() {
|
||||||
loggedIn()
|
loggedIn()
|
||||||
}
|
}
|
||||||
|
|
||||||
// IF THERE IS A TOKEN BUT NO USERNAME LOGOUT
|
// // IF THERE IS A TOKEN BUT NO USERNAME LOGOUT
|
||||||
if (allCookies !== '' && myStorage.length === 0) {
|
// if (allCookies !== '' && myStorage.length === 0) {
|
||||||
logout()
|
// logout()
|
||||||
}
|
// }
|
||||||
|
|
||||||
// IF THERE IS NO COOKIE BUT A USERNAME GET RID OF USERNAME LOCALLY.
|
// // IF THERE IS NO COOKIE BUT A USERNAME GET RID OF USERNAME LOCALLY.
|
||||||
if (allCookies === '' && myStorage.length !== 0) {
|
// if (allCookies === '' && myStorage.length !== 0) {
|
||||||
localStorage.removeItem('username')
|
// localStorage.removeItem('username')
|
||||||
document.querySelector("#loggeduser").innerHTML = 'You are not logged in'
|
// document.querySelector("#loggeduser").innerHTML = 'You are not logged in'
|
||||||
}
|
// }
|
Loading…
Reference in New Issue