cleaning up errors

This commit is contained in:
Steve White 2024-10-11 20:23:46 -05:00
parent c5640b54fd
commit ab5ccac8e3
4 changed files with 9 additions and 8 deletions

2
.env
View File

@ -1 +1 @@
REACT_APP_API_URL=http://10.0.0.16:8080
REACT_APP_API_URL=http://127.0.0.1:8080

View File

@ -1,5 +1,5 @@
// src/App.js
import React, { useState } from 'react';
import React, { useState, useEffect } from 'react';
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
import { useParams } from 'react-router-dom';
import Login from './components/Login';
@ -9,8 +9,12 @@ import Navbar from './components/Navbar'; // Correct import here
import './styles.css'
function App() {
const [token, setToken] = useState(null);
const [token, setToken] = useState(localStorage.getItem('token'));
useEffect(() => {
if (token) {
localStorage.setItem('token', token);
}
}, [token]);
return (
<Router>
<Navbar />

View File

@ -182,7 +182,7 @@ export default function ItemDetails({ item, token, onSave, onClose, boxId }) {
<Button variant="contained" color="primary" onClick={handleSave}>
Save Changes
</Button>
<Button onClick={onClose}>Close</Button>
<Button variant="contained" color="primary" onClick={onClose}>Close</Button>
</Container>
);
}

View File

@ -247,9 +247,6 @@ export default function Items({ token }) {
id="newItemImageUpload" // Unique ID
/>
<Button variant="contained" color="primary" onClick={handleAddItem}>
Add Item
</Button>
<Button variant="contained" color="primary" onClick={handleAddItem}>
Add Item
</Button>