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:
@@ -23,7 +23,13 @@ api.interceptors.request.use((config) => {
|
||||
api.interceptors.response.use(
|
||||
(response) => response,
|
||||
(error) => {
|
||||
if (error.response?.status === 401 || error.response?.status === 403) {
|
||||
// Only redirect to login for protected routes
|
||||
const protectedPaths = ['/colors', '/filaments'];
|
||||
const isProtectedRoute = protectedPaths.some(path =>
|
||||
error.config?.url?.includes(path) && error.config?.method !== 'get'
|
||||
);
|
||||
|
||||
if ((error.response?.status === 401 || error.response?.status === 403) && isProtectedRoute) {
|
||||
localStorage.removeItem('authToken');
|
||||
localStorage.removeItem('tokenExpiry');
|
||||
window.location.href = '/upadaj';
|
||||
|
||||
Reference in New Issue
Block a user