Unrated orders error fixed
This commit is contained in:
@@ -6,6 +6,7 @@ import CartTab from '../components/CartTab';
|
||||
import BottomNav from '../components/BottomNav';
|
||||
import type { Stall } from '../types';
|
||||
import './StallDetailScreen.css';
|
||||
import { getApiBaseUrl } from '../utils/api';
|
||||
|
||||
const StallDetailScreen: React.FC = () => {
|
||||
const { id } = useParams<{ id: string }>();
|
||||
@@ -18,7 +19,7 @@ const StallDetailScreen: React.FC = () => {
|
||||
const fetchStallDetails = async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const response = await fetch(`http://${window.location.hostname}:8080/api/stalls/${id}`);
|
||||
const response = await fetch(`${getApiBaseUrl()}/api/stalls/${id}`);
|
||||
if (!response.ok) throw new Error('Stall not found');
|
||||
const data = await response.json();
|
||||
|
||||
@@ -61,8 +62,7 @@ const StallDetailScreen: React.FC = () => {
|
||||
fetchStallDetails();
|
||||
|
||||
// SSE Real-time stock updates
|
||||
const host = window.location.hostname;
|
||||
const eventSource = new EventSource(`http://${host}:8080/api/stock/stream`);
|
||||
const eventSource = new EventSource(`${getApiBaseUrl()}/api/stock/stream`);
|
||||
|
||||
eventSource.addEventListener('stockUpdate', (event: any) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user