{
"count": 2,
"rows": [
{
"id": "5ab46e31-391c-46a7-8e45-db9ada07626d",
"name": "admin",
"email": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="68090c050106280f05090104460b0705">[email protected]</a>",
"phoneNumber": "95397454542325",
"username": "admin",
"password": "$2b$10$esLfedWAPEMAgWJ5HBAFQu6u47Cbfep7hnUTDZPswb4gWFhZW0rbm",
"role": "admin",
"isActive": true,
"createdAt": "2023-09-29T11:00:55.388Z",
"updatedAt": "2023-09-29T11:00:55.388Z"
},
{
"id": "58aacbcd-2344-40f1-a9e9-11c70d44cbb4",
"name": "Aman",
"email": "<a href='/cdn-cgi/l/email-protection' className='__cf_email__' data-cfemail='84e5e9e5eab6b4b4b4c4e3e9e5ede8aae7ebe9'>tvejsvup@qjpnzd.qjabl</a>",
"phoneNumber": "8304893218",
"username": "Aman-admin",
"password": "$2b$10$uZZrRz5bATzJ3jPCAURpKeEP/TaHhoWhmKUvWSyIrOvKMmD3yNuKi",
"role": "user",
"isActive": true,
"createdAt": "2023-10-07T09:58:51.193Z",
"updatedAt": "2023-10-07T10:00:31.590Z"
}
]
}
The above JSON data should be presented
'use client'
import React from 'react';
const plans = async () => {
const res = await fetch('http://localhost:3001/api/plans', { cache: 'no-store' });
console.log(res);
const users = await res.json();
return (
<div>
<button className='bg-sky-600 text-black p-2 rounded-lg absolute top-4 right-40 hover:text-white transition-colors'>Create plans</button>
<h1 className='absolute top-14 left-40'>Plans</h1>
<div>
<table className='table-column-group absolute top-24 left-40 min-w-full divide-y divide-gray-200 border'>
<thead>
<tr>
<th>Name</th>
<th>Email</th>
</tr>
</thead>
<tbody>
{users.map((data) => (
<tr key={data.id}>
<td>{data.name}</td>
<td>{data.email}</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
);
};
export default plans;
This code is for the frontend development using Next.js. As it appears to be a nested array, there might be formatting issues in display. Consider changing it to an object structure. Regular arrays display correctly, but this particular one seems to have some trouble rendering. Possible changes needed in the Next.js codebase to ensure proper display.