implemented post management dashboard and started work on projects
This commit is contained in:
@@ -1,21 +1,35 @@
|
||||
'use server'
|
||||
|
||||
import { ReactNode } from "react"
|
||||
import AuthHandler from "../authHandler"
|
||||
import { Post } from "@/model/Post"
|
||||
import { constructAPIUrl } from "@/util/Utils"
|
||||
import { tryFetchPosts } from "@/app/api/post/route";
|
||||
import { Post } from "@/model/Post";
|
||||
import { constructAPIUrl } from "@/util/Utils";
|
||||
import { ReactNode, useEffect } from "react";
|
||||
import TableGen from "../../../client/TableGen";
|
||||
import PostTable from "@/components/client/admin/PostTable";
|
||||
import { deletePost, getPosts } from "@/app/lib/postActions";
|
||||
|
||||
type Props = {
|
||||
children?:ReactNode
|
||||
}
|
||||
|
||||
export default async function PostView(props:Props){
|
||||
// const posts = await Post.findAll();
|
||||
|
||||
|
||||
export default async function PostView(props:Props){
|
||||
const headings = [
|
||||
'#',
|
||||
'Title',
|
||||
'Content',
|
||||
'Date Created',
|
||||
'Date Modified',
|
||||
'Edit',
|
||||
'Delete',
|
||||
]
|
||||
const data = await Post.findAll();
|
||||
const passData:any[] = data.map((e)=>JSON.parse(JSON.stringify(e)));
|
||||
return (
|
||||
<div>
|
||||
test
|
||||
<div className="w-[100%] min-h-fit bg-gray-100 overflow-scroll">
|
||||
<span className="flex flex-row flex-grow w-[100%] pl-2 pr-2"><h1 className="p-2 inline-block">Post Management</h1><section className="flex-grow"></section><button className='btn btn-success h-12 mt-auto mb-auto self-end'>New</button></span>
|
||||
<div className="w-[100%] m-auto">
|
||||
<PostTable data={passData} headings={headings} actions={{deletePost: deletePost, getPosts:getPosts}}></PostTable>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user