complete installation page - create reusable table - install and config react query

This commit is contained in:
Alihaghighattalab
2024-08-10 17:48:08 +03:30
parent c5e67d85ca
commit bfd9fa2b64
16 changed files with 1017 additions and 3 deletions
@@ -0,0 +1,19 @@
import { useQuery } from "@tanstack/react-query"
import { installationReportsCol } from "../../utility/reports"
import { Table } from "../common/table"
import { getReportsList } from "../../services/api"
import { useState } from "react"
import { SortingState } from "@tanstack/react-table"
export const InstallationReports = () => {
const [sorting, setSorting] = useState<SortingState>([])
const { data, isLoading } = useQuery({
queryKey: ["installation-reports-list"],
queryFn: getReportsList
})
if (isLoading) return <p>LODING .....</p>
return (
<Table columns={installationReportsCol} data={data?.data} sorting={sorting} setSorting={setSorting} />
)
}