logs removed from api.ts
This commit is contained in:
parent
325fe9735b
commit
a11194831d
@ -1,8 +1,8 @@
|
|||||||
const API_BASE_URL = import.meta.env.VITE_API_URL || 'http://localhost:3000/api/v1';
|
const API_BASE_URL = import.meta.env.VITE_API_URL || 'http://localhost:3000/api/v1';
|
||||||
|
|
||||||
// Debug logging
|
// Debug logging
|
||||||
console.log('API_BASE_URL:', API_BASE_URL);
|
// console.log('API_BASE_URL:', API_BASE_URL);
|
||||||
console.log('VITE_API_URL env:', import.meta.env.VITE_API_URL);
|
// console.log('VITE_API_URL env:', import.meta.env.VITE_API_URL);
|
||||||
|
|
||||||
// Helper function to get auth headers
|
// Helper function to get auth headers
|
||||||
function getAuthHeaders(): HeadersInit {
|
function getAuthHeaders(): HeadersInit {
|
||||||
@ -142,7 +142,7 @@ export interface UpdateArticleDto {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchArticles(params: FindArticlesParams = {}): Promise<ArticlesResponse> {
|
export async function fetchArticles(params: FindArticlesParams = {}): Promise<ArticlesResponse> {
|
||||||
console.log('fetchArticles called with params:', params, 'API_BASE_URL:', API_BASE_URL);
|
// console.log('fetchArticles called with params:', params, 'API_BASE_URL:', API_BASE_URL);
|
||||||
const searchParams = new URLSearchParams();
|
const searchParams = new URLSearchParams();
|
||||||
|
|
||||||
// Convert parameters to proper types for URLSearchParams
|
// Convert parameters to proper types for URLSearchParams
|
||||||
@ -157,17 +157,17 @@ export async function fetchArticles(params: FindArticlesParams = {}): Promise<Ar
|
|||||||
});
|
});
|
||||||
|
|
||||||
const url = `${API_BASE_URL}/articles?${searchParams}`;
|
const url = `${API_BASE_URL}/articles?${searchParams}`;
|
||||||
console.log('Fetching from:', url);
|
// console.log('Fetching from:', url);
|
||||||
|
|
||||||
const response = await authFetch(url);
|
const response = await authFetch(url);
|
||||||
console.log('Response status:', response.status, 'ok:', response.ok);
|
// console.log('Response status:', response.status, 'ok:', response.ok);
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error('Failed to fetch articles');
|
throw new Error('Failed to fetch articles');
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
console.log('Response data:', data);
|
// console.log('Response data:', data);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user