feat: добавить рабочий dashboard admin
- добавлен Mantine theme provider и AppShell layout\n- сгенерирован Backend API клиент и добавлены infra/business хуки\n- добавлены таблица assets, detail/presets panels и create asset modal
This commit is contained in:
17
apps/admin/src/infra/backend-api/hooks/use-get-asset.hook.ts
Normal file
17
apps/admin/src/infra/backend-api/hooks/use-get-asset.hook.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import useSWR from "swr"
|
||||
import type { SWRConfiguration } from "swr"
|
||||
|
||||
import { backendApi } from "../client"
|
||||
import type { AssetResponseDto } from "../generated/backend-api.generated"
|
||||
|
||||
export const getAssetKey = (publicId: string) => ["backend-api", "assets", "detail", publicId] as const
|
||||
|
||||
/**
|
||||
* Получение asset по publicId.
|
||||
*/
|
||||
export const useGetAsset = (publicId: string | null, config?: SWRConfiguration) => {
|
||||
const key = publicId !== null ? getAssetKey(publicId) : null
|
||||
const fetcher = () => backendApi.assets.getAsset({ publicId: publicId ?? "" })
|
||||
|
||||
return useSWR<AssetResponseDto>(key, fetcher, config)
|
||||
}
|
||||
Reference in New Issue
Block a user