diff --git a/ReactLibrary/src/components/footer/Footer.jsx b/ReactLibrary/src/components/footer/Footer.jsx index a2472bf..d37bf56 100644 --- a/ReactLibrary/src/components/footer/Footer.jsx +++ b/ReactLibrary/src/components/footer/Footer.jsx @@ -1,5 +1,5 @@ import './Footer.css'; -import useAuthorization from '../users/context_hooks/AuthorizationHook'; +// import useAuthorization from '../users/context_hooks/AuthorizationHook'; const Footer = () => { const year = new Date().getFullYear(); diff --git a/ReactLibrary/src/components/users/userPage/UserObjectHook.js b/ReactLibrary/src/components/users/userPage/UserObjectHook.js index cdcfd95..c66f578 100644 --- a/ReactLibrary/src/components/users/userPage/UserObjectHook.js +++ b/ReactLibrary/src/components/users/userPage/UserObjectHook.js @@ -1,26 +1,18 @@ -import { useEffect, useState } from 'react'; -import PropTypes from 'prop-types'; -import UsersApiService from '../service/UsersApiService'; +import { useState } from 'react'; -const useUserObject = async (id) => { - // debugger; - let userObject = { - name: 'user', +const useUserObject = () => { + const emptyObject = { + name: '', password: '', role: 'user', id: '', }; - const data = await UsersApiService.get(id); - if (data && data.name) { - //userObject.name = data.name; - } + const [userObject, setUserObject] = useState({ ...emptyObject }); + return { - userObject, + user: userObject, + setUser: setUserObject, }; }; -useUserObject.propTypes = { - id: PropTypes.number, -}; - -export default useUserObject; +export default useUserObject; \ No newline at end of file diff --git a/ReactLibrary/src/pages/UserPage.jsx b/ReactLibrary/src/pages/UserPage.jsx index 0b1802d..0c627c7 100644 --- a/ReactLibrary/src/pages/UserPage.jsx +++ b/ReactLibrary/src/pages/UserPage.jsx @@ -1,10 +1,10 @@ import AuthorizationForm from '../components/users/authorization/form/AuthorizationForm.jsx'; import UserPageInfo from '../components/users/userPage/UserPageInfo.jsx'; -import useAuthorization from '../components/users/context_hooks/AuthorizationHook.js'; +// import useAuthorization from '../components/users/context_hooks/AuthorizationHook'; const UserPage = () => { - let { id } = useAuthorization(); - // let id = localStorage.getItem('userId'); + // let { id } = useAuthorization(); + let id = localStorage.getItem('userId'); id = parseInt(id, 10); if (!id) { return (