cleaning up errors
This commit is contained in:
parent
c5640b54fd
commit
ab5ccac8e3
2
.env
2
.env
|
@ -1 +1 @@
|
|||
REACT_APP_API_URL=http://10.0.0.16:8080
|
||||
REACT_APP_API_URL=http://127.0.0.1:8080
|
||||
|
|
10
src/App.js
10
src/App.js
|
@ -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 />
|
||||
|
|
|
@ -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>
|
||||
);
|
||||
}
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue