overhaul chat structure
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import {post} from './api.js';
|
||||
|
||||
// Every page gets this control from the same server-rendered header.
|
||||
for (const button of document.querySelectorAll('[data-sign-out]')) {
|
||||
button.addEventListener('click', async () => {
|
||||
button.disabled = true;
|
||||
const result = await post('/logout', {});
|
||||
if (result.error) {
|
||||
button.disabled = false;
|
||||
const notice = document.querySelector('#shellNotice');
|
||||
notice.textContent = result.error;
|
||||
notice.classList.remove('hidden');
|
||||
return;
|
||||
}
|
||||
location.assign('/');
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user