implemented logging
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import Layout from '../layouts/Layout.astro';
|
||||
|
||||
const API_URL = (typeof process !== 'undefined' ? process.env.PUBLIC_API_URL : import.meta.env.PUBLIC_API_URL) || 'http://localhost:3000';
|
||||
console.log('Connecting to backend at:', API_URL);
|
||||
|
||||
interface Post {
|
||||
slug: string;
|
||||
@@ -18,7 +19,8 @@ try {
|
||||
error = 'Failed to fetch posts';
|
||||
}
|
||||
} catch (e) {
|
||||
error = 'Could not connect to backend';
|
||||
error = `Could not connect to backend at ${API_URL}: ${e instanceof Error ? e.message : String(e)}`;
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
function formatSlug(slug: string) {
|
||||
|
||||
@@ -25,7 +25,8 @@ try {
|
||||
error = 'Post not found';
|
||||
}
|
||||
} catch (e) {
|
||||
error = 'Could not connect to backend';
|
||||
error = `Could not connect to backend at ${API_URL}: ${e instanceof Error ? e.message : String(e)}`;
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
function formatSlug(slug: string) {
|
||||
|
||||
Reference in New Issue
Block a user