Add environment variable for API URL; update TypeScript configuration to include vite-env; refactor API client to use environment variable; modify timestamp fields in database schemas to include timezone support
This commit is contained in:
@@ -2,7 +2,7 @@ import ky from "ky";
|
||||
|
||||
// Базовый API клиент
|
||||
export const api = ky.create({
|
||||
prefixUrl: "http://localhost:3000",
|
||||
prefixUrl: import.meta.env.VITE_API_URL,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
@@ -11,6 +11,7 @@ export const api = ky.create({
|
||||
(request) => {
|
||||
// Автоматически добавляем токен из localStorage если есть
|
||||
const token = localStorage.getItem("authToken");
|
||||
|
||||
if (token) {
|
||||
request.headers.set("Authorization", `Bearer ${token}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user