users card
This commit is contained in:
parent
192c6c627e
commit
29d4007e04
File diff suppressed because one or more lines are too long
@ -114,10 +114,10 @@ app.enable('trust proxy');
|
|||||||
|
|
||||||
app.use(
|
app.use(
|
||||||
'/api/users',
|
'/api/users',
|
||||||
passport.authenticate('jwt', { session: false }),
|
|
||||||
usersRoutes,
|
usersRoutes,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
app.use(
|
app.use(
|
||||||
'/api/demo_requests',
|
'/api/demo_requests',
|
||||||
passport.authenticate('jwt', { session: false }),
|
passport.authenticate('jwt', { session: false }),
|
||||||
|
|||||||
@ -12,7 +12,6 @@ const { parse } = require('json2csv');
|
|||||||
|
|
||||||
const { checkCrudPermissions } = require('../middlewares/check-permissions');
|
const { checkCrudPermissions } = require('../middlewares/check-permissions');
|
||||||
|
|
||||||
router.use(checkCrudPermissions('users'));
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @swagger
|
* @swagger
|
||||||
@ -307,9 +306,8 @@ router.get(
|
|||||||
wrapAsync(async (req, res) => {
|
wrapAsync(async (req, res) => {
|
||||||
const filetype = req.query.filetype;
|
const filetype = req.query.filetype;
|
||||||
|
|
||||||
const globalAccess = req.currentUser.app_role.globalAccess;
|
const globalAccess = req.currentUser?.app_role?.globalAccess || false;
|
||||||
|
const currentUser = req.currentUser || null;
|
||||||
const currentUser = req.currentUser;
|
|
||||||
const payload = await UsersDBApi.findAll(req.query, globalAccess, {
|
const payload = await UsersDBApi.findAll(req.query, globalAccess, {
|
||||||
currentUser,
|
currentUser,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,29 +1,58 @@
|
|||||||
import React from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import type { ReactElement } from 'react';
|
import type { ReactElement } from 'react';
|
||||||
import Head from 'next/head';
|
import Head from 'next/head';
|
||||||
import LayoutGuest from '../../layouts/Guest';
|
import LayoutGuest from '../../layouts/Guest';
|
||||||
import WebSiteHeader from '../../components/WebPageComponents/Header';
|
import WebSiteHeader from '../../components/WebPageComponents/Header';
|
||||||
import WebSiteFooter from '../../components/WebPageComponents/Footer';
|
import WebSiteFooter from '../../components/WebPageComponents/Footer';
|
||||||
|
|
||||||
|
type User = {
|
||||||
|
id: string;
|
||||||
|
firstName: string;
|
||||||
|
lastName: string;
|
||||||
|
email: string;
|
||||||
|
};
|
||||||
|
|
||||||
export default function Users() {
|
export default function Users() {
|
||||||
|
const [users, setUsers] = useState<User[]>([]);
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
fetch('/api/users')
|
||||||
|
.then((res) => res.json())
|
||||||
|
.then((data) => {
|
||||||
|
setUsers(data.rows);
|
||||||
|
setLoading(false);
|
||||||
|
})
|
||||||
|
.catch(() => setLoading(false));
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col min-h-screen">
|
<div className="flex flex-col min-h-screen">
|
||||||
<Head>
|
<Head>
|
||||||
<title>Users - Strategic Intelligence Engine</title>
|
<title>Users - Strategic Intelligence Engine</title>
|
||||||
<meta
|
<meta
|
||||||
name="description"
|
name="description"
|
||||||
content="This is a placeholder public Users page for the Strategic Intelligence Engine."
|
content="Public list of users for the Strategic Intelligence Engine."
|
||||||
/>
|
/>
|
||||||
</Head>
|
</Head>
|
||||||
|
|
||||||
<WebSiteHeader projectName="IntelliLedger Consulting" />
|
<WebSiteHeader projectName="IntelliLedger Consulting" />
|
||||||
|
|
||||||
<main className="flex-grow bg-white rounded-none">
|
<main className="flex-grow bg-white px-4 py-8">
|
||||||
<section className="py-16 text-center">
|
<section className="max-w-4xl mx-auto">
|
||||||
<h1 className="text-4xl font-bold mb-4">Users</h1>
|
<h1 className="text-4xl font-bold mb-4">Users</h1>
|
||||||
<p className="text-lg text-gray-600">
|
{loading ? (
|
||||||
This is an empty public page named Users. Content coming soon.
|
<p>Loading users...</p>
|
||||||
</p>
|
) : (
|
||||||
|
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4">
|
||||||
|
{users.map((user) => (
|
||||||
|
<div key={user.id} className="bg-white shadow p-4 rounded-lg">
|
||||||
|
<p className="font-medium text-lg">{user.firstName} {user.lastName}</p>
|
||||||
|
<p className="text-sm text-gray-500">{user.email}</p>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user