diff --git a/packages/api/tsconfig.json b/packages/api/tsconfig.json index 11f658f..4abe3d9 100644 --- a/packages/api/tsconfig.json +++ b/packages/api/tsconfig.json @@ -14,5 +14,5 @@ "types": ["node"] }, "include": ["src/**/*"], - "exclude": ["node_modules", "dist"] + "exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"] } diff --git a/packages/web/src/pages/Register.tsx b/packages/web/src/pages/Register.tsx index 3235c26..d932c71 100644 --- a/packages/web/src/pages/Register.tsx +++ b/packages/web/src/pages/Register.tsx @@ -3,13 +3,12 @@ */ import React, { useState } from 'react'; -import { useNavigate, Link } from 'react-router-dom'; +import { Link } from 'react-router-dom'; import { useAuth } from '../contexts/AuthContext'; import { authService } from '../services/auth.service'; import '../styles/Auth.css'; const Register: React.FC = () => { - const navigate = useNavigate(); const { register } = useAuth(); const [name, setName] = useState(''); diff --git a/packages/web/src/services/auth.service.ts b/packages/web/src/services/auth.service.ts index 8b27d70..7c55dc3 100644 --- a/packages/web/src/services/auth.service.ts +++ b/packages/web/src/services/auth.service.ts @@ -13,7 +13,7 @@ import { ResetPasswordRequest, } from '../types/auth'; -const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:3001'; +const API_URL = (import.meta as any).env?.VITE_API_URL || 'http://localhost:3001'; const AUTH_ENDPOINT = `${API_URL}/api/auth`; // Token storage keys @@ -67,11 +67,14 @@ async function fetchWithAuth( options: RequestInit = {} ): Promise { const token = tokenService.getAccessToken(); - const headers: HeadersInit = { + const headers: Record = { 'Content-Type': 'application/json', - ...options.headers, }; + if (options.headers) { + Object.assign(headers, options.headers); + } + if (token) { headers['Authorization'] = `Bearer ${token}`; }