|
|
@ -1,5 +1,4 @@
|
|
|
|
import { useState } from 'react';
|
|
|
|
import { useCallback, useEffect, useState } from 'react';
|
|
|
|
import { useQuery } from 'react-query';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// material-ui
|
|
|
|
// material-ui
|
|
|
|
import { Button, Grid, Link } from '@mui/material';
|
|
|
|
import { Button, Grid, Link } from '@mui/material';
|
|
|
@ -80,24 +79,24 @@ const PublicBoard = () => {
|
|
|
|
{ headerName: '조회수', headerAlign: 'center', field: 'inHit', align: 'right', width: 80 }
|
|
|
|
{ headerName: '조회수', headerAlign: 'center', field: 'inHit', align: 'right', width: 80 }
|
|
|
|
];
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
const params = {
|
|
|
|
const search = useCallback(() => {
|
|
|
|
page: rowsState.page,
|
|
|
|
const params = {
|
|
|
|
size: rowsState.pageSize
|
|
|
|
page: rowsState.page,
|
|
|
|
};
|
|
|
|
size: rowsState.pageSize
|
|
|
|
|
|
|
|
};
|
|
|
|
const search = async () => {
|
|
|
|
|
|
|
|
const res = await findPublicBoards(params);
|
|
|
|
findPublicBoards(params).then((response) => {
|
|
|
|
if (res && res.data) {
|
|
|
|
// console.log(response);
|
|
|
|
setTotalCount(res.count);
|
|
|
|
if (response && response.data) {
|
|
|
|
setRowsState((prevState) => ({ ...prevState, rows: res.data }));
|
|
|
|
setTotalCount(response.count);
|
|
|
|
}
|
|
|
|
setRowsState((prevState) => ({ ...prevState, rows: response.data }));
|
|
|
|
};
|
|
|
|
}
|
|
|
|
useQuery(['pboards', params.page, params.size], search);
|
|
|
|
});
|
|
|
|
// const { isLoading, data, isError } = useQuery(['pboards', params.page, params.size], search);
|
|
|
|
}, [rowsState.page, rowsState.pageSize]);
|
|
|
|
|
|
|
|
|
|
|
|
// useEffect(() => {
|
|
|
|
useEffect(() => {
|
|
|
|
// search();
|
|
|
|
search();
|
|
|
|
// }, [search]); // rowsState.page, rowsState.pageSize, rowsState.rows]);
|
|
|
|
}, [search]); // rowsState.page, rowsState.pageSize, rowsState.rows]);
|
|
|
|
|
|
|
|
|
|
|
|
const handleOnCellClick = (e) => {
|
|
|
|
const handleOnCellClick = (e) => {
|
|
|
|
if (e?.field === 'inTitle') {
|
|
|
|
if (e?.field === 'inTitle') {
|
|
|
|