1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

(bug) all orders is shown in my orders of admin

This commit is contained in:
Du Peng 2022-09-16 17:58:02 +02:00
parent 96a0f10747
commit b635113843

View File

@ -34,7 +34,7 @@ export const OrdersDashboard: React.FC<OrdersDashboardProps> = ({ currentUser, o
const [totalCount, setTotalCount] = useState<number>(0); const [totalCount, setTotalCount] = useState<number>(0);
useEffect(() => { useEffect(() => {
OrderAPI.index({}).then(res => { OrderAPI.index({ user_id: currentUser.id }).then(res => {
setPageCount(res.total_pages); setPageCount(res.total_pages);
setTotalCount(res.total_count); setTotalCount(res.total_count);
setOrders(res.data); setOrders(res.data);
@ -67,7 +67,7 @@ export const OrdersDashboard: React.FC<OrdersDashboardProps> = ({ currentUser, o
*/ */
const handlePagination = (page: number) => { const handlePagination = (page: number) => {
if (page !== currentPage) { if (page !== currentPage) {
OrderAPI.index({ page }).then(res => { OrderAPI.index({ user_id: currentUser.id, page }).then(res => {
setCurrentPage(page); setCurrentPage(page);
setOrders(res.data); setOrders(res.data);
setPageCount(res.total_pages); setPageCount(res.total_pages);