diff --git a/logout.js b/logout.js new file mode 100644 index 0000000..b772974 --- /dev/null +++ b/logout.js @@ -0,0 +1,20 @@ +//VARIBLES + +let username = localStorage.getItem('username'); + +//LOGOUT FETCH FUNCTION + +async function logout() { + let sendLogoutInfo = { "name": username } + fetch('/api/logout/', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(sendRegisterInfo), + }); + document.querySelector("#errormessage").innerHTML = 'Logged out.' + localStorage.removeItem('username') + + } + \ No newline at end of file