Skip to content

Commit a30858c

Browse files
authored
Update edit.html
1 parent 372a492 commit a30858c

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/Wiki/edit.html

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ <h2>Edit Wiki Post</h2>
114114
const wikiContentInput = document.getElementById('wikiContent');
115115
const urlParams = new URLSearchParams(window.location.search);
116116
const wikiTitle = urlParams.get('edit');
117+
const authorizedUsers = ['kRxZy_kRxZy', 'mcgdj', 'MyScratchedAccount'];
117118

118119
if (!wikiTitle) {
119120
alert('No wiki title provided to edit.');
@@ -141,7 +142,7 @@ <h2>Edit Wiki Post</h2>
141142

142143
// Check if the user is authorized to edit the wiki
143144
const username = localStorage.getItem('username');
144-
if (username !== wiki.owner && !['kRxZy_kRxZy', 'mcgdj', 'MyScratchedAccount'].includes(username)) {
145+
if (!username || (username !== wiki.owner && !authorizedUsers.includes(username))) {
145146
alert('You are not authorized to edit this wiki.');
146147
window.location.href = 'sitemaplinks.html'; // Redirect to wiki list if not authorized
147148
}
@@ -170,11 +171,6 @@ <h2>Edit Wiki Post</h2>
170171
}
171172

172173
try {
173-
// Log to verify the values being sent
174-
console.log('Updating wiki with ID:', wikiId);
175-
console.log('Updated Title:', updatedTitle);
176-
console.log('Updated Content:', updatedContent);
177-
178174
const response = await fetch(`${backendUrl}/wikis/${wikiId}`, {
179175
method: 'PUT',
180176
headers: { 'Content-Type': 'application/json' },

0 commit comments

Comments
 (0)