api ulangan
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type { BannerListItem } from "@/features/objects/lib/data";
|
||||
import AddedBanner from "@/features/objects/ui/Addedbanners";
|
||||
import AddedBanner from "@/features/objects/ui/AddedBanners";
|
||||
import { Button } from "@/shared/ui/button";
|
||||
import {
|
||||
Dialog,
|
||||
|
||||
@@ -1,14 +1 @@
|
||||
import type { ResportListRes } from "@/features/reports/lib/data";
|
||||
import httpClient from "@/shared/config/api/httpClient";
|
||||
import { API_URLS } from "@/shared/config/api/URLs";
|
||||
import type { AxiosResponse } from "axios";
|
||||
|
||||
export const report_api = {
|
||||
async list(params: {
|
||||
limit: number;
|
||||
offset: number;
|
||||
}): Promise<AxiosResponse<ResportListRes>> {
|
||||
const res = await httpClient.get(`${API_URLS.REPORT}list/`, { params });
|
||||
return res;
|
||||
},
|
||||
};
|
||||
export const report_api = {};
|
||||
|
||||
@@ -1,21 +1,4 @@
|
||||
import { report_api } from "@/features/reports/lib/api";
|
||||
import ReportsTable from "@/features/reports/ui/ReportsTable";
|
||||
import Pagination from "@/shared/ui/pagination";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useState } from "react";
|
||||
|
||||
const UsersList = () => {
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
const limit = 20;
|
||||
const { data, isLoading, isError } = useQuery({
|
||||
queryKey: ["report_list", currentPage],
|
||||
queryFn: () =>
|
||||
report_api.list({ limit, offset: (currentPage - 1) * limit }),
|
||||
select(data) {
|
||||
return data.data.data;
|
||||
},
|
||||
});
|
||||
const totalPages = data ? Math.ceil(data.count / limit) : 1;
|
||||
// const [plans, setPlans] = useState<ReportsTypeList[]>(ReportsData);
|
||||
|
||||
// const [editingPlan, setEditingPlan] = useState<ReportsTypeList | null>(null);
|
||||
@@ -55,21 +38,6 @@ const UsersList = () => {
|
||||
</DialogContent>
|
||||
</Dialog> */}
|
||||
</div>
|
||||
|
||||
<ReportsTable
|
||||
// handleDelete={handleDelete}
|
||||
plans={data ? data.results : []}
|
||||
// setDialogOpen={setDialogOpen}
|
||||
// setEditingPlan={setEditingPlan}
|
||||
isLoading={isLoading}
|
||||
isError={isError}
|
||||
/>
|
||||
|
||||
<Pagination
|
||||
currentPage={currentPage}
|
||||
setCurrentPage={setCurrentPage}
|
||||
totalPages={totalPages}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { RegionListResData } from "@/features/region/lib/data";
|
||||
import type { UserData } from "@/features/users/lib/data";
|
||||
import type { UserData, UserListRes } from "@/features/users/lib/data";
|
||||
import AddUsers from "@/features/users/ui/AddUsers";
|
||||
import { Button } from "@/shared/ui/button";
|
||||
import {
|
||||
@@ -13,7 +12,7 @@ import { Plus } from "lucide-react";
|
||||
import { type Dispatch, type SetStateAction } from "react";
|
||||
|
||||
interface Props {
|
||||
setRegionValue: Dispatch<SetStateAction<RegionListResData | null>>;
|
||||
setRegionValue: Dispatch<SetStateAction<UserListRes | null>>;
|
||||
dialogOpen: boolean;
|
||||
setDialogOpen: Dispatch<SetStateAction<boolean>>;
|
||||
editingUser: UserData | null;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { RegionListResData } from "@/features/region/lib/data";
|
||||
import { user_api } from "@/features/users/lib/api";
|
||||
import type { UserData } from "@/features/users/lib/data";
|
||||
import type { UserData, UserListRes } from "@/features/users/lib/data";
|
||||
import DeleteUser from "@/features/users/ui/DeleteUser";
|
||||
import Filter from "@/features/users/ui/Filter";
|
||||
import UserTable from "@/features/users/ui/UserTable";
|
||||
@@ -14,9 +13,7 @@ const UsersList = () => {
|
||||
const [opneDelete, setOpenDelete] = useState(false);
|
||||
const [userDelete, setUserDelete] = useState<UserData | null>(null);
|
||||
|
||||
const [regionValue, setRegionValue] = useState<RegionListResData | null>(
|
||||
null,
|
||||
);
|
||||
const [regionValue, setRegionValue] = useState<UserListRes | null>(null);
|
||||
const limit = 20;
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
|
||||
|
||||
@@ -1,11 +1 @@
|
||||
import httpClient from "@/shared/config/api/httpClient";
|
||||
import { API_URLS } from "@/shared/config/api/URLs";
|
||||
import type { GetMeRes } from "@/shared/config/api/user/type";
|
||||
import type { AxiosResponse } from "axios";
|
||||
|
||||
export const user_api = {
|
||||
async getMe(): Promise<AxiosResponse<GetMeRes>> {
|
||||
const res = httpClient.get(API_URLS.GET_ME);
|
||||
return res;
|
||||
},
|
||||
};
|
||||
export const user_api = {};
|
||||
|
||||
Reference in New Issue
Block a user