forked from VinokurovVE/tests
Layout, Pages, Dashboard, MUI
This commit is contained in:
@ -1,26 +1,26 @@
|
||||
import { useState} from 'react'
|
||||
import { useState } from 'react'
|
||||
import RoleCard from '../components/RoleCard'
|
||||
import Modal from '../components/Modal'
|
||||
import useDataFetching from '../components/FetchingData'
|
||||
|
||||
interface IRoleCard{
|
||||
id: number
|
||||
name: string
|
||||
}
|
||||
interface IRoleCard {
|
||||
id: number
|
||||
name: string
|
||||
}
|
||||
interface Props {
|
||||
showModal: boolean;
|
||||
}
|
||||
function Users() {
|
||||
const [showModal, setShowModal] = useState<Props>({showModal: false});
|
||||
const cards = useDataFetching<IRoleCard[]>("http://localhost:8000/auth/role/",[])
|
||||
|
||||
showModal: boolean;
|
||||
}
|
||||
function Roles() {
|
||||
const [showModal, setShowModal] = useState<Props>({ showModal: false });
|
||||
const cards = useDataFetching<IRoleCard[]>(`${import.meta.env.VITE_API_URL}/auth/role/`, [])
|
||||
|
||||
return (
|
||||
<div>
|
||||
{cards.map((card, index) => <RoleCard key={index} {...card}/>)}
|
||||
<button className='absolute w-0 h-0' onClick={() => setShowModal({showModal:true})}>+</button>
|
||||
<Modal {...showModal}/>
|
||||
{cards.map((card, index) => <RoleCard key={index} {...card} />)}
|
||||
<button className='absolute w-0 h-0' onClick={() => setShowModal({ showModal: true })}>+</button>
|
||||
<Modal {...showModal} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Users
|
||||
export default Roles
|
Reference in New Issue
Block a user