lab8 it is annoying
This commit is contained in:
parent
61abe13183
commit
0302c95582
@ -1,5 +1,5 @@
|
|||||||
import './Footer.css';
|
import './Footer.css';
|
||||||
import useAuthorization from '../users/context_hooks/AuthorizationHook';
|
// import useAuthorization from '../users/context_hooks/AuthorizationHook';
|
||||||
|
|
||||||
const Footer = () => {
|
const Footer = () => {
|
||||||
const year = new Date().getFullYear();
|
const year = new Date().getFullYear();
|
||||||
|
@ -1,26 +1,18 @@
|
|||||||
import { useEffect, useState } from 'react';
|
import { useState } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import UsersApiService from '../service/UsersApiService';
|
|
||||||
|
|
||||||
const useUserObject = async (id) => {
|
const useUserObject = () => {
|
||||||
// debugger;
|
const emptyObject = {
|
||||||
let userObject = {
|
name: '',
|
||||||
name: 'user',
|
|
||||||
password: '',
|
password: '',
|
||||||
role: 'user',
|
role: 'user',
|
||||||
id: '',
|
id: '',
|
||||||
};
|
};
|
||||||
const data = await UsersApiService.get(id);
|
const [userObject, setUserObject] = useState({ ...emptyObject });
|
||||||
if (data && data.name) {
|
|
||||||
//userObject.name = data.name;
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
userObject,
|
user: userObject,
|
||||||
|
setUser: setUserObject,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
useUserObject.propTypes = {
|
|
||||||
id: PropTypes.number,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default useUserObject;
|
export default useUserObject;
|
@ -1,10 +1,10 @@
|
|||||||
import AuthorizationForm from '../components/users/authorization/form/AuthorizationForm.jsx';
|
import AuthorizationForm from '../components/users/authorization/form/AuthorizationForm.jsx';
|
||||||
import UserPageInfo from '../components/users/userPage/UserPageInfo.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 = () => {
|
const UserPage = () => {
|
||||||
let { id } = useAuthorization();
|
// let { id } = useAuthorization();
|
||||||
// let id = localStorage.getItem('userId');
|
let id = localStorage.getItem('userId');
|
||||||
id = parseInt(id, 10);
|
id = parseInt(id, 10);
|
||||||
if (!id) {
|
if (!id) {
|
||||||
return (
|
return (
|
||||||
|
Loading…
Reference in New Issue
Block a user