sync
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { useGetAssetVersions } from "infra/backend-api"
|
||||
|
||||
import type { AssetVersionsHistory } from "../types/assets-api.type"
|
||||
|
||||
/**
|
||||
* История source versions выбранного asset.
|
||||
*/
|
||||
export const useAssetVersions = (publicId: string | null): AssetVersionsHistory => {
|
||||
const versionsQuery = useGetAssetVersions(publicId)
|
||||
|
||||
const refresh = async () => {
|
||||
await versionsQuery.mutate()
|
||||
}
|
||||
|
||||
return {
|
||||
currentVersion: versionsQuery.data?.currentVersion ?? null,
|
||||
error: versionsQuery.error,
|
||||
isLoading: versionsQuery.isLoading,
|
||||
isRefreshing: versionsQuery.isValidating,
|
||||
publicId: versionsQuery.data?.publicId ?? publicId,
|
||||
refresh,
|
||||
versions: versionsQuery.data?.versions ?? [],
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user