@@ -114,6 +114,7 @@ <h2>Edit Wiki Post</h2>
114
114
const wikiContentInput = document . getElementById ( 'wikiContent' ) ;
115
115
const urlParams = new URLSearchParams ( window . location . search ) ;
116
116
const wikiTitle = urlParams . get ( 'edit' ) ;
117
+ const authorizedUsers = [ 'kRxZy_kRxZy' , 'mcgdj' , 'MyScratchedAccount' ] ;
117
118
118
119
if ( ! wikiTitle ) {
119
120
alert ( 'No wiki title provided to edit.' ) ;
@@ -141,7 +142,7 @@ <h2>Edit Wiki Post</h2>
141
142
142
143
// Check if the user is authorized to edit the wiki
143
144
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 ) ) ) {
145
146
alert ( 'You are not authorized to edit this wiki.' ) ;
146
147
window . location . href = 'sitemaplinks.html' ; // Redirect to wiki list if not authorized
147
148
}
@@ -170,11 +171,6 @@ <h2>Edit Wiki Post</h2>
170
171
}
171
172
172
173
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
-
178
174
const response = await fetch ( `${ backendUrl } /wikis/${ wikiId } ` , {
179
175
method : 'PUT' ,
180
176
headers : { 'Content-Type' : 'application/json' } ,
0 commit comments