mirror of
https://github.com/get-drexa/drive.git
synced 2026-02-03 00:31:17 +00:00
refactor: unify mock/real dir content table
This commit is contained in:
@@ -91,10 +91,32 @@ type DirectoryContentQueryParams = {
|
||||
limit: number
|
||||
}
|
||||
|
||||
type DirectoryContentPageParam = {
|
||||
orderBy: DirectoryContentOrderBy
|
||||
direction: DirectoryContentOrderDirection
|
||||
limit: number
|
||||
cursor: string
|
||||
}
|
||||
|
||||
const directoryContentQueryKey = (
|
||||
accountId: string | undefined,
|
||||
directoryId: string,
|
||||
) => ["accounts", accountId, "directories", directoryId, "content"]
|
||||
): readonly (string | undefined)[] => [
|
||||
"accounts",
|
||||
accountId,
|
||||
"directories",
|
||||
directoryId,
|
||||
"content",
|
||||
]
|
||||
export type DirectoryContentQuery = ReturnType<
|
||||
typeof infiniteQueryOptions<
|
||||
typeof DirectoryContentResponse.infer,
|
||||
Error,
|
||||
InfiniteData<typeof DirectoryContentResponse.infer>,
|
||||
readonly (string | undefined)[],
|
||||
DirectoryContentPageParam
|
||||
>
|
||||
>
|
||||
export const directoryContentQueryAtom = atomFamily(
|
||||
({ directoryId, orderBy, direction, limit }: DirectoryContentQueryParams) =>
|
||||
atom((get) => {
|
||||
|
||||
Reference in New Issue
Block a user