Skip to content

Commit a3730fc

Browse files
authored
Update Wiki.html
1 parent 3de1209 commit a3730fc

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

Wiki/Wiki.html

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,7 @@ <h2>Create New Page</h2>
8484
async function fetchWiki() {
8585
try {
8686
const res = await fetch(JSON_BIN_READ_URL);
87-
if (!res.ok) throw new Error('Failed to fetch data');
8887
const data = await res.json();
89-
console.log('Fetched data:', data);
9088
const pages = data.record;
9189
document.getElementById('wiki').innerHTML = pages.map((page, index) => `
9290
<div class="page">
@@ -98,7 +96,6 @@ <h3>${page.title}</h3>
9896
`).join('');
9997
} catch (error) {
10098
console.error('Error fetching wiki:', error);
101-
alert('Failed to load wiki data. Please try again later.');
10299
}
103100
}
104101

@@ -109,11 +106,9 @@ <h3>${page.title}</h3>
109106
headers: { 'Content-Type': 'application/json' },
110107
body: JSON.stringify({ record: pages })
111108
});
112-
if (!res.ok) throw new Error('Failed to update data');
113109
fetchWiki();
114110
} catch (error) {
115111
console.error('Error updating wiki:', error);
116-
alert('Failed to update wiki. Please try again.');
117112
}
118113
}
119114

@@ -126,14 +121,12 @@ <h3>${page.title}</h3>
126121
}
127122
try {
128123
const res = await fetch(JSON_BIN_READ_URL);
129-
if (!res.ok) throw new Error('Failed to fetch data');
130124
const data = await res.json();
131125
const pages = data.record;
132126
pages.push({ title, content });
133127
updateWiki(pages);
134128
} catch (error) {
135129
console.error('Error adding page:', error);
136-
alert('Failed to add page. Please try again.');
137130
}
138131
}
139132

@@ -142,14 +135,12 @@ <h3>${page.title}</h3>
142135
if (newContent !== null) {
143136
try {
144137
const res = await fetch(JSON_BIN_READ_URL);
145-
if (!res.ok) throw new Error('Failed to fetch data');
146138
const data = await res.json();
147139
const pages = data.record;
148140
pages[index].content = newContent;
149141
updateWiki(pages);
150142
} catch (error) {
151143
console.error('Error editing page:', error);
152-
alert('Failed to edit page. Please try again.');
153144
}
154145
}
155146
}
@@ -158,14 +149,12 @@ <h3>${page.title}</h3>
158149
if (confirm('Are you sure you want to delete this page?')) {
159150
try {
160151
const res = await fetch(JSON_BIN_READ_URL);
161-
if (!res.ok) throw new Error('Failed to fetch data');
162152
const data = await res.json();
163153
const pages = data.record;
164154
pages.splice(index, 1);
165155
updateWiki(pages);
166156
} catch (error) {
167157
console.error('Error deleting page:', error);
168-
alert('Failed to delete page. Please try again.');
169158
}
170159
}
171160
}

0 commit comments

Comments
 (0)