import prisma from '@/lib/Prisma'; import React from 'react' import useSWR from 'swr' function CreateUser(props){ const data = props?.feed; const [userinfo, setUserInfo] = React.useState(); const token = userinfo?.map((item)=>{ return item?.token; }) // console.log(token); const details = userinfo?.map((item)=>{ return item?.details; }) const language = details?.map((item, index)=>{ return item[index]?.language; }) // console.log(language); const module_version = details?.map((item, index)=>{ return item[index]?.module_version; }) // console.log(module_version); React.useEffect(()=>{ setUserInfo(data) },[]) return ( <> {token &&
Token : {token}
} {language &&Language : {language}
} {module_version &&Module_Version : {module_version}
} > ) } export const getStaticProps = async () => { // Fetch data from external API const feed = await prisma.users.findMany({ select: { token: true, details: true } }) // Pass data to the page via props return { props: { feed }, // revalidate: 10, } } export default CreateUser