Skip to content

Commit 1bb769d

Browse files
authored
Update Wiki.html
1 parent 97ac8ef commit 1bb769d

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

Wiki/Wiki.html

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ <h2>Create New Page</h2>
9797
// Fetch and display the wiki pages
9898
async function fetchWiki() {
9999
try {
100-
const res = await fetch(JSON_BIN_URL);
100+
const res = await fetch(JSON_BIN_URL, {
101+
method: 'GET'
102+
});
101103
if (!res.ok) {
102104
throw new Error(`Failed to fetch wiki pages: ${res.status}`);
103105
}
@@ -122,7 +124,7 @@ <h3>${page.title}</h3>
122124
const res = await fetch(JSON_BIN_URL, {
123125
method: 'PUT',
124126
headers: {
125-
'Content-Type': 'application/json',
127+
'Content-Type': 'application/json'
126128
},
127129
body: JSON.stringify({ record: pages })
128130
});
@@ -146,7 +148,9 @@ <h3>${page.title}</h3>
146148
}
147149

148150
try {
149-
const res = await fetch(JSON_BIN_URL);
151+
const res = await fetch(JSON_BIN_URL, {
152+
method: 'GET'
153+
});
150154
const data = await res.json();
151155
const pages = data.record;
152156
pages.push({ title, content });
@@ -161,7 +165,9 @@ <h3>${page.title}</h3>
161165
const newContent = prompt('Edit page content:');
162166
if (newContent !== null) {
163167
try {
164-
const res = await fetch(JSON_BIN_URL);
168+
const res = await fetch(JSON_BIN_URL, {
169+
method: 'GET'
170+
});
165171
const data = await res.json();
166172
const pages = data.record;
167173
pages[index].content = newContent;
@@ -176,7 +182,9 @@ <h3>${page.title}</h3>
176182
async function deletePage(index) {
177183
if (confirm('Are you sure you want to delete this page?')) {
178184
try {
179-
const res = await fetch(JSON_BIN_URL);
185+
const res = await fetch(JSON_BIN_URL, {
186+
method: 'GET'
187+
});
180188
const data = await res.json();
181189
const pages = data.record;
182190
pages.splice(index, 1); // Remove the page from the array

0 commit comments

Comments
 (0)