Use dv_template_uid (v2 envelope renames dv_template_id to UUID slug)
This commit is contained in:
parent
1e33a465d8
commit
d9a911facf
@ -193,7 +193,7 @@ export interface DVScreen {
|
|||||||
id: number;
|
id: number;
|
||||||
source_screen_id: number;
|
source_screen_id: number;
|
||||||
screen_name: string;
|
screen_name: string;
|
||||||
dv_template_id: number;
|
dv_template_uid: string;
|
||||||
layout?: any;
|
layout?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,10 +210,10 @@ export interface DetailViewResponse {
|
|||||||
data: Record<string, unknown>;
|
data: Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDetailView(dvSourceId: number, instanceId: string): Promise<DetailViewResponse> {
|
export function getDetailView(dvSourceIdOrUid: number | string, instanceId: string): Promise<DetailViewResponse> {
|
||||||
return request(
|
return request(
|
||||||
"GET",
|
"GET",
|
||||||
`/app/${APP_ID}/view/detailview/${dvSourceId}?instance_id=${encodeURIComponent(instanceId)}`,
|
`/app/${APP_ID}/view/detailview/${encodeURIComponent(String(dvSourceIdOrUid))}?instance_id=${encodeURIComponent(instanceId)}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -99,8 +99,8 @@ export default function DetailViewPanel({ viewId, instanceId }: Props) {
|
|||||||
if (!instanceId) return;
|
if (!instanceId) return;
|
||||||
setLoading(true); setError(null);
|
setLoading(true); setError(null);
|
||||||
getDVScreen(viewId)
|
getDVScreen(viewId)
|
||||||
.then(dv => getDetailView(dv.dv_template_id, instanceId))
|
.then(dv => getDetailView(dv.dv_template_uid, instanceId))
|
||||||
.catch(() => getDetailView(Number(viewId) || 0, instanceId))
|
.catch(() => getDetailView(viewId, instanceId))
|
||||||
.then(res => {
|
.then(res => {
|
||||||
setFields(res.config?.fields?.filter((f: any) => f.field_key !== "") ?? []);
|
setFields(res.config?.fields?.filter((f: any) => f.field_key !== "") ?? []);
|
||||||
setData(res.data ?? {});
|
setData(res.data ?? {});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user