WIP - configure list views

This commit is contained in:
Francisco Gaona
2026-01-31 02:46:33 +01:00
parent c7282ee2a0
commit 97fc235636
12 changed files with 1409 additions and 59 deletions

View File

@@ -1,11 +1,13 @@
import type { PageLayout, CreatePageLayoutRequest, UpdatePageLayoutRequest } from '~/types/page-layout'
import type { PageLayout, CreatePageLayoutRequest, UpdatePageLayoutRequest, PageLayoutType } from '~/types/page-layout'
export const usePageLayouts = () => {
const { api } = useApi()
const getPageLayouts = async (objectId?: string) => {
const getPageLayouts = async (objectId?: string, layoutType?: PageLayoutType) => {
try {
const params = objectId ? { objectId } : {}
const params: Record<string, string> = {}
if (objectId) params.objectId = objectId
if (layoutType) params.layoutType = layoutType
const response = await api.get('/page-layouts', { params })
return response
} catch (error) {
@@ -24,9 +26,11 @@ export const usePageLayouts = () => {
}
}
const getDefaultPageLayout = async (objectId: string) => {
const getDefaultPageLayout = async (objectId: string, layoutType: PageLayoutType = 'detail') => {
try {
const response = await api.get(`/page-layouts/default/${objectId}`)
const response = await api.get(`/page-layouts/default/${objectId}`, {
params: { layoutType }
})
return response
} catch (error) {
console.error('Error fetching default page layout:', error)