lab8 it is annoying
This commit is contained in:
parent
61abe13183
commit
0302c95582
@ -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();
|
||||
|
@ -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;
|
@ -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 (
|
||||
|
Loading…
Reference in New Issue
Block a user