import { getReaders } from "@/utils/querys/rfid/getReaders";
import { readerColumns } from "@/utils/tableData/rfid/readers/readerColumns";
import { ReaderTable } from "@/utils/tableData/rfid/readers/readerData";
import { useQuery } from "@tanstack/react-query";

export default function RfidPage() {
    const { data, isError, isLoading } = useQuery(getReaders());

    if (isError) {
        return <div>Error</div>;
    }

    if (isLoading) {
        return <div>Loading</div>;
    }

    return (
        <div className="m-2">
            <ReaderTable
                columns={readerColumns}
                data={data.data.sort((a: any, b: any) =>
                    a.reader.localeCompare(b.reader)
                )}
                //style={style}
            />
        </div>
    );
}
