Skip to content

Commit 67ddeb0

Browse files
committed
Merge branches 'dev' and 'dev' of https://github.com/touchmegit1/SmallTrend into dev
2 parents de5d6ec + b55bf83 commit 67ddeb0

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

frontend/src/config/axiosConfig.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import axios from 'axios';
22

33
const api = axios.create({
4-
baseURL: import.meta.env.VITE_API_BASE_URL || 'http://localhost:8081/api',
4+
baseURL: import.meta.env.VITE_API_BASE_URL || '/api',
55
headers: {
66
'Content-Type': 'application/json',
77
},
@@ -62,7 +62,7 @@ api.interceptors.response.use(
6262
try {
6363
// Quick validation call - if this fails, token is bad
6464
await axios.get(
65-
`${import.meta.env.VITE_API_BASE_URL || 'http://localhost:8081/api'}/auth/validate`,
65+
`${import.meta.env.VITE_API_BASE_URL || '/api'}/auth/validate`,
6666
{ headers: { Authorization: `Bearer ${token}` } }
6767
);
6868
// Token is valid - this is a genuine permission error (user lacks role)

frontend/src/services/inventory/disposalService.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
const SPRING_API = "http://localhost:8081/api/inventory/disposal-vouchers";
1+
const API_BASE = (import.meta.env.VITE_API_BASE_URL || "/api").replace(/\/$/, "");
2+
const SPRING_API =
3+
import.meta.env.VITE_INVENTORY_DISPOSAL_API_BASE_URL || `${API_BASE}/inventory/disposal-vouchers`;
24

35
function getAuthHeaders() {
46
const token = localStorage.getItem("token");

frontend/src/services/inventory/inventoryService.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
const API_BASE = (import.meta.env.VITE_API_BASE_URL || "/api").replace(/\/$/, "");
12
const SPRING_API =
2-
import.meta.env.VITE_INVENTORY_API_BASE_URL || "http://localhost:8081/api/inventory";
3+
import.meta.env.VITE_INVENTORY_API_BASE_URL || `${API_BASE}/inventory`;
34

45
// ─── Helper: get auth token ──────────────────────────────
56
function getAuthHeaders() {

frontend/src/utils/inventory.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ export function resolveInventoryImageUrl(imageUrl) {
4343
return imageUrl;
4444
}
4545

46+
const apiBase = (import.meta.env.VITE_API_BASE_URL || "/api").replace(/\/$/, "");
4647
const inventoryApiBase =
47-
import.meta.env.VITE_INVENTORY_API_BASE_URL || "http://localhost:8081/api/inventory";
48+
import.meta.env.VITE_INVENTORY_API_BASE_URL || `${apiBase}/inventory`;
4849
const apiOrigin = inventoryApiBase.replace(/\/api\/inventory\/?$/, "");
4950
return `${apiOrigin}${imageUrl.startsWith("/") ? "" : "/"}${imageUrl}`;
5051
}

0 commit comments

Comments
 (0)