This commit is contained in:
@@ -96,8 +96,8 @@
|
||||
async function loadMotalah() {
|
||||
try {
|
||||
const [mRes, bRes] = await Promise.all([
|
||||
fetch(MOTALAH_API),
|
||||
fetch(CALIBRE_API),
|
||||
window.orgAuth.fetch(MOTALAH_API),
|
||||
window.orgAuth.fetch(CALIBRE_API),
|
||||
]);
|
||||
if (mRes.ok) motalahEntries = await mRes.json();
|
||||
if (bRes.ok) calibreBooks = await bRes.json();
|
||||
@@ -301,7 +301,7 @@
|
||||
notes: motalahNotesEl.value.trim() || null,
|
||||
};
|
||||
try {
|
||||
const r = await fetch(MOTALAH_API, {
|
||||
const r = await window.orgAuth.fetch(MOTALAH_API, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(payload),
|
||||
@@ -350,7 +350,7 @@
|
||||
|
||||
async function loadAll() {
|
||||
try {
|
||||
const r = await fetch(`${API}/entries`);
|
||||
const r = await window.orgAuth.fetch(`${API}/entries`);
|
||||
if (!r.ok) throw new Error(r.status);
|
||||
allEntries = await r.json();
|
||||
buildTodayMap();
|
||||
@@ -383,7 +383,7 @@
|
||||
}
|
||||
|
||||
async function postEntry(payload) {
|
||||
const r = await fetch(`${API}/entries`, {
|
||||
const r = await window.orgAuth.fetch(`${API}/entries`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(payload),
|
||||
@@ -393,7 +393,7 @@
|
||||
}
|
||||
|
||||
async function deleteEntry(id) {
|
||||
const r = await fetch(`${API}/entries/${id}`, { method: "DELETE" });
|
||||
const r = await window.orgAuth.fetch(`${API}/entries/${id}`, { method: "DELETE" });
|
||||
if (!r.ok) throw new Error(await r.text());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user