diff --git a/client/src/App.js b/client/src/App.js index 32ce672..4dd7aa3 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -25,10 +25,11 @@ const User = ({user}) => { const Restricted = ({user}) => { if (!user) return ''; + const { upload, admin } = user.permissions; return (
- {user.admin ? Panel : ''} - Upload + {admin ? Panel : ''} + {upload || admin ? Upload: '' }
); diff --git a/client/src/css/Panel.css b/client/src/css/Panel.css index df498e6..62c4633 100644 --- a/client/src/css/Panel.css +++ b/client/src/css/Panel.css @@ -1,4 +1,5 @@ .panel { height: inherit; width: inherit; + flex-direction: column; } \ No newline at end of file diff --git a/client/src/pages/Panel.js b/client/src/pages/Panel.js index 359c229..ad74748 100644 --- a/client/src/pages/Panel.js +++ b/client/src/pages/Panel.js @@ -1,15 +1,34 @@ -import React, { useEffect } from "react"; +import React, { useEffect, useState } from "react"; import '../css/Panel.css'; +const User = ({user}) => { + + return ( +
+ {user.tag} +
+ ); + +}; + const Panel = () => { + const [users, setUsers] = useState([]); + useEffect(() => { + + (async () => { + const response = await fetch('/api/users'); + if (response.status !== 200) return; + const users = await response.json(); + setUsers(users); + })(); }, []); return ( -
- asd +
+ {users.length ? users.map(user => ):'No users'}
);