WIP - configure list views
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user