refactor: remove console logs and clean up fetch URL assignments in various components

This commit is contained in:
2026-02-13 16:30:18 -06:00
parent e05e50f2b8
commit 472e42a02f
14 changed files with 11 additions and 40 deletions

View File

@@ -26,9 +26,7 @@
credentials: 'include'
});
if (response.ok) {
const data = await response.json();
console.log('Countries data received:', data);
console.log('First country sample:', data[0]);
const data = await response.json();
if (Array.isArray(data)) {
countries = data;
} else if (data.items && Array.isArray(data.items)) {
@@ -37,8 +35,7 @@
console.error('Unexpected data format:', data);
countries = [];
}
filteredCountries = countries;
console.log('Total countries loaded:', countries.length);
filteredCountries = countries;
} else {
error = `Error: ${response.status} - ${response.statusText}`;
console.error('Error response:', await response.text());

View File

@@ -47,8 +47,7 @@
});
if (response.ok) {
const data = await response.json();
console.log('Tariff fractions data received:', data);
const data = await response.json();
if (data.items && Array.isArray(data.items)) {
if (append) {
@@ -58,8 +57,7 @@
}
currentPage = data.page;
totalPages = data.pages;
hasMore = currentPage < totalPages;
console.log(`Loaded page ${currentPage}/${totalPages}, total items: ${fractions.length}`);
hasMore = currentPage < totalPages;
} else {
console.error('Unexpected data format:', data);
if (!append) fractions = [];

View File

@@ -27,8 +27,7 @@
credentials: 'include'
});
if (response.ok) {
const data = await response.json();
console.log('Units data received:', data);
const data = await response.json();
// El backend puede devolver { items: [...] } o directamente un array
if (Array.isArray(data)) {
units = data;

View File

@@ -140,8 +140,7 @@ class CompanyStore {
},
body: JSON.stringify({ companyId: company.id }),
credentials: 'include'
});
console.log('Cookie set via server:', `active_company_id=${company.id}`);
});
} catch (error) {
console.error('Error setting active company cookie:', error);
}

View File

@@ -36,7 +36,6 @@ export const GET: RequestHandler = async ({ cookies, url }) => {
try {
const fetchUrl = `${baseUrl}v1/a76/classes?${queryString}`;
console.log('Fetching classes from:', fetchUrl);
const response = await fetch(
fetchUrl,

View File

@@ -32,7 +32,6 @@ export const GET: RequestHandler = async ({ cookies, url, params }) => {
try {
const fetchUrl = `${baseUrl}v1/a76/classes/${id}?company_id=${companyId}`;
console.log('Fetching class from:', fetchUrl);
const response = await fetch(
fetchUrl,

View File

@@ -35,8 +35,7 @@ export const GET: RequestHandler = async ({ cookies, url }) => {
const queryString = searchParams.toString();
try {
const fetchUrl = `${baseUrl}v1/a76/parts?${queryString}`;
console.log('Fetching parts from:', fetchUrl);
const fetchUrl = `${baseUrl}v1/a76/parts?${queryString}`;
const response = await fetch(
fetchUrl,

View File

@@ -31,8 +31,7 @@ export const GET: RequestHandler = async ({ cookies, url, params }) => {
const baseUrl = apiUrl?.endsWith('/') ? apiUrl : `${apiUrl}/`;
try {
const fetchUrl = `${baseUrl}v1/a76/parts/${id}?company_id=${companyId}`;
console.log('Fetching part from:', fetchUrl);
const fetchUrl = `${baseUrl}v1/a76/parts/${id}?company_id=${companyId}`;
const response = await fetch(
fetchUrl,

View File

@@ -20,8 +20,6 @@ export const GET: RequestHandler = async ({ cookies, url }) => {
try {
const fetchUrl = `${baseUrl}v1/a76/tariff-fractions?${queryString}`;
console.log('Fetching tariff fractions from:', fetchUrl);
console.log('Token:', token ? 'Present' : 'Missing');
const response = await fetch(
fetchUrl,
@@ -35,8 +33,6 @@ export const GET: RequestHandler = async ({ cookies, url }) => {
);
const data = await response.json();
console.log('Response status:', response.status);
console.log('Response data:', JSON.stringify(data).substring(0, 200));
if (!response.ok) {
return new Response(JSON.stringify(data), {

View File

@@ -36,8 +36,6 @@ export const GET: RequestHandler = async ({ cookies, url }) => {
try {
const fetchUrl = `${baseUrl}v1/a76/units-of-measure?${queryString}`;
console.log('Fetching units from:', fetchUrl);
console.log('Token:', token ? 'Present' : 'Missing');
const response = await fetch(
fetchUrl,
@@ -51,8 +49,6 @@ export const GET: RequestHandler = async ({ cookies, url }) => {
);
const data = await response.json();
console.log('Response status:', response.status);
console.log('Response data:', JSON.stringify(data).substring(0, 200));
if (!response.ok) {
return new Response(JSON.stringify(data), {

View File

@@ -31,8 +31,7 @@ export const GET: RequestHandler = async ({ cookies, params, url }) => {
const baseUrl = apiUrl?.endsWith('/') ? apiUrl : `${apiUrl}/`;
try {
const fetchUrl = `${baseUrl}v1/a76/units-of-measure/${id}?company_id=${companyId}`;
console.log('Fetching unit of measure from:', fetchUrl);
const fetchUrl = `${baseUrl}v1/a76/units-of-measure/${id}?company_id=${companyId}`;
const response = await fetch(
fetchUrl,

View File

@@ -187,8 +187,7 @@
selectedInvoiceId = null;
} else {
selectedInvoiceId = invoice.id;
}
console.log('Selected Invoice ID:', selectedInvoiceId);
}
}
const selectedInvoice = $derived(

View File

@@ -484,8 +484,7 @@
const actualResponse = response as any;
const items = actualResponse.data?.items || [];
if (items.length === 0) {
console.log('No exchange rate found for', date);
if (items.length === 0) {
if (!uiStore.isExchangeRateDialogOpen) {
missingExchangeRateDate = date;
showExchangeRateDialog = true;