From 691203d0c8e12f2d908ddc61cbf22dc63eb06bf1 Mon Sep 17 00:00:00 2001 From: Haris Kurspahic Date: Thu, 23 Nov 2023 11:24:52 +0100 Subject: [PATCH 1/2] fe changes regarding refactor --- frontend/react/src/Customer.jsx | 1 + .../src/components/context/AuthContext.jsx | 1 + .../customer/CreateCustomerDrawer.jsx | 1 - .../src/components/customer/CustomerCard.jsx | 7 +- .../customer/UpdateCustomerForm.jsx | 70 ++++++++++++++++--- frontend/react/src/components/login/Login.jsx | 19 ++--- .../react/src/components/shared/SideBar.jsx | 9 +-- .../react/src/components/signup/Signup.jsx | 18 +---- frontend/react/src/index.css | 1 + frontend/react/src/main.jsx | 4 +- frontend/react/src/services/client.js | 20 +++++- 11 files changed, 96 insertions(+), 55 deletions(-) diff --git a/frontend/react/src/Customer.jsx b/frontend/react/src/Customer.jsx index e57e00f..8ba2a8b 100644 --- a/frontend/react/src/Customer.jsx +++ b/frontend/react/src/Customer.jsx @@ -12,6 +12,7 @@ import CreateCustomerDrawer from "./components/customer/CreateCustomerDrawer.jsx import {errorNotification} from "./services/notification.js"; const Customer = () => { + const [customers, setCustomers] = useState([]); const [loading, setLoading] = useState(false); const [err, setError] = useState(""); diff --git a/frontend/react/src/components/context/AuthContext.jsx b/frontend/react/src/components/context/AuthContext.jsx index 754745c..576d1f8 100644 --- a/frontend/react/src/components/context/AuthContext.jsx +++ b/frontend/react/src/components/context/AuthContext.jsx @@ -10,6 +10,7 @@ import {jwtDecode} from "jwt-decode"; const AuthContext = createContext({}); const AuthProvider = ({ children }) => { + const [customer, setCustomer] = useState(null); const setCustomerFromToken = () => { diff --git a/frontend/react/src/components/customer/CreateCustomerDrawer.jsx b/frontend/react/src/components/customer/CreateCustomerDrawer.jsx index 3b8a2b2..41c76fb 100644 --- a/frontend/react/src/components/customer/CreateCustomerDrawer.jsx +++ b/frontend/react/src/components/customer/CreateCustomerDrawer.jsx @@ -16,7 +16,6 @@ const CloseIcon = () => "x"; const CreateCustomerDrawer = ({ fetchCustomers }) => { const { isOpen, onOpen, onClose } = useDisclosure() - return <>