fix:dasboard top article
This commit is contained in:
commit
57332172bf
|
|
@ -130,6 +130,7 @@ export default function DashboardContainer() {
|
|||
page: topPagespage,
|
||||
search: "",
|
||||
sort: "desc",
|
||||
isPublish: true,
|
||||
};
|
||||
const res = await getTopArticles(req);
|
||||
setTopPages(getTableNumber(10, res.data?.data));
|
||||
|
|
@ -154,7 +155,7 @@ export default function DashboardContainer() {
|
|||
|
||||
const getTableNumber = (limit: number, data: any) => {
|
||||
if (data) {
|
||||
const startIndex = limit * (page - 1);
|
||||
const startIndex = limit * (topPagespage - 1);
|
||||
let iterate = 0;
|
||||
const newData = data.map((value: any) => {
|
||||
iterate++;
|
||||
|
|
|
|||
|
|
@ -200,7 +200,6 @@ export default function ArticleTable() {
|
|||
|
||||
async function initState() {
|
||||
loading();
|
||||
console.log("test", getIds(selectedCategories));
|
||||
const req = {
|
||||
limit: showData,
|
||||
page: page,
|
||||
|
|
@ -536,7 +535,7 @@ export default function ArticleTable() {
|
|||
isClearable={true}
|
||||
isSearchable={true}
|
||||
isMulti={true}
|
||||
placeholder="Kategori..."
|
||||
placeholder="Author..."
|
||||
name="sub-module"
|
||||
options={users}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ export async function getTopArticles(props: PaginationRequest) {
|
|||
const { page, limit, search, startDate, endDate, isPublish, category } =
|
||||
props;
|
||||
return await httpGetInterceptor(
|
||||
`/articles?sort=desc&sortBy=created_at&limit=${limit}&page=${page}&isPublish=${
|
||||
`/articles?limit=${limit}&page=${page}&isPublish=${
|
||||
isPublish === undefined ? "" : isPublish
|
||||
}&title=${search}&startDate=${startDate || ""}&endDate=${
|
||||
endDate || ""
|
||||
|
|
|
|||
Loading…
Reference in New Issue