@@ -212,14 +212,14 @@ <h2>Wiki Posts</h2>
212
212
document . addEventListener ( 'DOMContentLoaded' , ( ) => {
213
213
const createWikiForm = document . getElementById ( 'createWikiForm' ) ;
214
214
const wikiList = document . getElementById ( 'wikiList' ) ;
215
- const backendUrl = 'https://api.jsonbin.io/v3/b/67c73db1e41b4d34e4a0bfb1/ ' ; // Replace with your backend URL
215
+ const backendUrl = 'https://thejsurlback.onrender.com/api ' ; // Replace with your backend URL
216
216
217
217
// Retrieve username from localStorage (this is optional, users can view wikis when logged out)
218
218
const username = localStorage . getItem ( 'username' ) ;
219
219
220
220
// Fetch and display all wikis
221
221
const fetchWikis = async ( ) => {
222
- const response = await fetch ( `${ backendUrl } /latest ` ) ;
222
+ const response = await fetch ( `${ backendUrl } /wikis ` ) ;
223
223
const wikis = await response . json ( ) ;
224
224
wikiList . innerHTML = '' ; // Clear the current list
225
225
@@ -251,7 +251,7 @@ <h3>${wiki.title}</h3>
251
251
const title = document . getElementById ( 'wikiTitle' ) . value ;
252
252
const content = document . getElementById ( 'wikiContent' ) . value ;
253
253
254
- const response = await fetch ( `${ backendUrl } /latest ` , {
254
+ const response = await fetch ( `${ backendUrl } /wikis ` , {
255
255
method : 'POST' ,
256
256
headers : { 'Content-Type' : 'application/json' } ,
257
257
body : JSON . stringify ( { title, content, owner : username } ) , // Send username from localStorage
0 commit comments