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