Refactoring
This commit is contained in:
@@ -5,7 +5,7 @@ import { constructAPIUrl } from "@/util/Utils";
|
||||
import { ReactNode, useEffect } from "react";
|
||||
import EntityManagementTable from "../../../client/EntityManagementTable";
|
||||
import PostTable from "@/components/client/admin/PostTable";
|
||||
import { deletePost, getPostsWithBuckets, updatePost } from "@/app/lib/actions/entityManagement/postActions";
|
||||
import { deletePost, getPostsWithBucketsAndProject, updatePost } from "@/app/lib/actions/entityManagement/postActions";
|
||||
import { getProjects } from "@/app/lib/actions/entityManagement/projectActions";
|
||||
import { Bucket, Project, Post, dbSync, Attachment } from "@/model/Models";
|
||||
import { tryCreateAttachment } from "@/app/api/attachment/route";
|
||||
@@ -13,22 +13,20 @@ import { tryCreateAttachment } from "@/app/api/attachment/route";
|
||||
type Props = {
|
||||
children?:ReactNode
|
||||
}
|
||||
|
||||
async function getHeadings(){
|
||||
let headings:string[] = ['#', 'Title', 'Content', 'Project', 'CreatedAt', 'UpdatedAt']
|
||||
|
||||
return headings
|
||||
}
|
||||
|
||||
export default async function PostView(props:Props){
|
||||
await dbSync;
|
||||
const sync = await dbSync;
|
||||
|
||||
const headings = await getHeadings();
|
||||
|
||||
const headings = [
|
||||
'#',
|
||||
'Title',
|
||||
'Content',
|
||||
'Project',
|
||||
'Date Created',
|
||||
'Date Modified',
|
||||
]
|
||||
const actions = {
|
||||
deletePost: deletePost,
|
||||
getPosts:getPostsWithBuckets,
|
||||
getPosts:getPostsWithBucketsAndProject,
|
||||
getProjects:getProjects,
|
||||
savePost:updatePost,
|
||||
// uploadAttachment:tryCreateAttachment
|
||||
@@ -39,7 +37,6 @@ export default async function PostView(props:Props){
|
||||
|
||||
return (
|
||||
<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={posts}
|
||||
projects={projects}
|
||||
|
||||
Reference in New Issue
Block a user