Spaces:
Sleeping
Sleeping
Siddharaj Shirke commited on
Commit ·
c0bd6ec
1
Parent(s): b4125e1
fix: update frontend API calls to use relative paths for production
Browse files
frontend/src/components/Form.jsx
CHANGED
|
@@ -31,7 +31,7 @@ export default function Form({ setResult, setLoading }) {
|
|
| 31 |
e.preventDefault();
|
| 32 |
setLoading(true);
|
| 33 |
try {
|
| 34 |
-
const response = await axios.post('
|
| 35 |
setResult(response.data);
|
| 36 |
} catch (error) {
|
| 37 |
console.error("Prediction error", error);
|
|
|
|
| 31 |
e.preventDefault();
|
| 32 |
setLoading(true);
|
| 33 |
try {
|
| 34 |
+
const response = await axios.post('/api/predict', formData);
|
| 35 |
setResult(response.data);
|
| 36 |
} catch (error) {
|
| 37 |
console.error("Prediction error", error);
|
frontend/src/components/Sidebar.jsx
CHANGED
|
@@ -9,7 +9,7 @@ export default function Sidebar({ onSelectResult, onNewAssessment }) {
|
|
| 9 |
const fetchHistory = async () => {
|
| 10 |
try {
|
| 11 |
setLoading(true);
|
| 12 |
-
const res = await axios.get('
|
| 13 |
setHistory(res.data);
|
| 14 |
} catch (error) {
|
| 15 |
console.error("Failed to load history", error);
|
|
@@ -21,7 +21,7 @@ export default function Sidebar({ onSelectResult, onNewAssessment }) {
|
|
| 21 |
const handleClearHistory = async () => {
|
| 22 |
if (window.confirm("Are you sure you want to clear all history? This action cannot be undone.")) {
|
| 23 |
try {
|
| 24 |
-
await axios.delete('
|
| 25 |
setHistory([]);
|
| 26 |
} catch (error) {
|
| 27 |
console.error("Failed to clear history", error);
|
|
|
|
| 9 |
const fetchHistory = async () => {
|
| 10 |
try {
|
| 11 |
setLoading(true);
|
| 12 |
+
const res = await axios.get('/api/history?limit=20');
|
| 13 |
setHistory(res.data);
|
| 14 |
} catch (error) {
|
| 15 |
console.error("Failed to load history", error);
|
|
|
|
| 21 |
const handleClearHistory = async () => {
|
| 22 |
if (window.confirm("Are you sure you want to clear all history? This action cannot be undone.")) {
|
| 23 |
try {
|
| 24 |
+
await axios.delete('/api/history');
|
| 25 |
setHistory([]);
|
| 26 |
} catch (error) {
|
| 27 |
console.error("Failed to clear history", error);
|