checkpoint
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Inbox: loads messages as JSON (GET /messages) and marks them read (POST /messages/{id}/read).
|
||||
// Inbox: loads messages as JSON (GET /messages/list) and marks them read (POST /messages/{id}/read).
|
||||
const inbox = document.querySelector('.inbox');
|
||||
const list = inbox.querySelector('.inbox-list');
|
||||
const status = inbox.querySelector('.inbox-status');
|
||||
@@ -8,7 +8,7 @@ const dateFormat = new Intl.DateTimeFormat(document.documentElement.lang, { date
|
||||
|
||||
async function load() {
|
||||
try {
|
||||
const res = await fetch(`${t.api}?unreadOnly=${unreadOnly.checked}`, { headers: { Accept: 'application/json' } });
|
||||
const res = await fetch(`${t.list}?unreadOnly=${unreadOnly.checked}`, { headers: { Accept: 'application/json' } });
|
||||
if (!res.ok || res.redirected) throw new Error(res.status);
|
||||
render(await res.json());
|
||||
} catch {
|
||||
@@ -65,7 +65,7 @@ function markReadButton(id, li) {
|
||||
button.textContent = t.markRead;
|
||||
button.addEventListener('click', async () => {
|
||||
button.disabled = true;
|
||||
const res = await fetch(`${t.api}/${id}/read`, {
|
||||
const res = await fetch(`${t.base}/${id}/read`, {
|
||||
method: 'POST',
|
||||
headers: { RequestVerificationToken: t.token }
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user