Fix API connectivity and import filament data from PDF
- Update all environment files to use new PostgreSQL API endpoint - Fix CORS configuration in API server - Import 35 filaments and 29 colors from PDF data - Fix TypeScript type error in dashboard - Add back emoji icons for dark mode toggle - Remove debugging code and test buttons - Clean up error handling
This commit is contained in:
16
app/page.tsx
16
app/page.tsx
@@ -42,9 +42,19 @@ export default function Home() {
|
||||
|
||||
const filaments = await filamentService.getAll();
|
||||
setFilaments(filaments);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
console.error('API Error:', err);
|
||||
setError(err instanceof Error ? err.message : 'Greška pri učitavanju filamenata');
|
||||
|
||||
// More descriptive error messages
|
||||
if (err.code === 'ERR_NETWORK') {
|
||||
setError('Network Error - Unable to connect to API');
|
||||
} else if (err.response) {
|
||||
setError(`Server error: ${err.response.status} - ${err.response.statusText}`);
|
||||
} else if (err.request) {
|
||||
setError('No response from server - check if API is running');
|
||||
} else {
|
||||
setError(err.message || 'Greška pri učitavanju filamenata');
|
||||
}
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -91,7 +101,7 @@ export default function Home() {
|
||||
className="p-2 bg-white/50 dark:bg-gray-700/50 backdrop-blur text-gray-800 dark:text-gray-200 rounded-full hover:bg-white/80 dark:hover:bg-gray-600/80 transition-all duration-200 hover:scale-110 shadow-md ml-2"
|
||||
title={darkMode ? 'Svetla tema' : 'Tamna tema'}
|
||||
>
|
||||
{darkMode ? 'Svetla' : 'Tamna'}
|
||||
{darkMode ? '☀️' : '🌙'}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user