Refactoring
This commit is contained in:
@@ -20,7 +20,7 @@ import { useState } from "react";
|
||||
import { Project, Post, Bucket } from "@/model/Models";
|
||||
import { ActionResult } from "@/app/lib/actions/ActionResult";
|
||||
import { handleActionResult } from "@/app/lib/actions/clientActionHandler";
|
||||
import { getPostsWithBuckets } from "@/app/lib/actions/entityManagement/postActions";
|
||||
import { getPostsWithBucketsAndProject } from "@/app/lib/actions/entityManagement/postActions";
|
||||
import { PostAttributesWithBuckets } from "@/model/Post";
|
||||
|
||||
type Actions = {
|
||||
@@ -100,7 +100,7 @@ export default function PostTable(props: Props) {
|
||||
project_id: e.project_id
|
||||
})
|
||||
.then(res => handleActionResult(res))
|
||||
.then(getPostsWithBuckets)
|
||||
.then(getPostsWithBucketsAndProject)
|
||||
.then(res => {
|
||||
if (!res.error && res.result) setPosts(res.result);
|
||||
})
|
||||
@@ -169,7 +169,7 @@ export default function PostTable(props: Props) {
|
||||
}
|
||||
|
||||
return <>
|
||||
<EntityManagementTable key="der-table" headings={props.headings}>
|
||||
<EntityManagementTable entityName="Post" key="der-table" headings={props.headings}>
|
||||
{posts.map((postData: Partial<PostAttributesWithBuckets>) => <TableRow headings={props.headings}
|
||||
postData={postData}
|
||||
key={postData.id}/> )}
|
||||
|
||||
Reference in New Issue
Block a user