1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-29 09:49:38 +02:00

refactor: Remove console logs in adventures page server code

This commit is contained in:
Sean Morley 2024-07-12 10:03:06 -04:00
parent 87231818d1
commit fa57209127

View file

@ -447,14 +447,14 @@ export const actions: Actions = {
} }
// Start with the provided URL or default to the filtered adventures endpoint // Start with the provided URL or default to the filtered adventures endpoint
let url: string = next || previous || `${serverEndpoint}/api/adventures/filtered`; let url: string = next || previous || '/api/adventures/filtered';
// Extract the path and query parameters after '/api' // Extract the path starting from '/api'
const apiIndex = url.indexOf('/api'); const apiIndex = url.indexOf('/api');
if (apiIndex !== -1) { if (apiIndex !== -1) {
url = `${serverEndpoint}${url.slice(apiIndex)}`; url = url.slice(apiIndex);
} else { } else {
url = `${serverEndpoint}/api/adventures/filtered`; url = '/api/adventures/filtered';
} }
// Replace or add the page number in the URL // Replace or add the page number in the URL
@ -466,11 +466,12 @@ export const actions: Actions = {
url += `page=${page}`; url += `page=${page}`;
} }
console.log(url); const fullUrl = `${serverEndpoint}${url}`;
console.log(fullUrl);
console.log(serverEndpoint); console.log(serverEndpoint);
try { try {
const response = await fetch(url, { const response = await fetch(fullUrl, {
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
Cookie: `${event.cookies.get('auth')}` Cookie: `${event.cookies.get('auth')}`