Skip to content

Commit

Permalink
refactor: Remove console logs in adventures page server code
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmorley15 committed Jul 12, 2024
1 parent 8723181 commit fa57209
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions frontend/src/routes/adventures/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,14 +447,14 @@ export const actions: Actions = {
}

// 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');
if (apiIndex !== -1) {
url = `${serverEndpoint}${url.slice(apiIndex)}`;
url = url.slice(apiIndex);
} else {
url = `${serverEndpoint}/api/adventures/filtered`;
url = '/api/adventures/filtered';
}

// Replace or add the page number in the URL
Expand All @@ -466,11 +466,12 @@ export const actions: Actions = {
url += `page=${page}`;
}

console.log(url);
const fullUrl = `${serverEndpoint}${url}`;
console.log(fullUrl);
console.log(serverEndpoint);

try {
const response = await fetch(url, {
const response = await fetch(fullUrl, {
headers: {
'Content-Type': 'application/json',
Cookie: `${event.cookies.get('auth')}`
Expand Down

0 comments on commit fa57209

Please sign in to comment.