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;
|
||||
source_screen_id: number;
|
||||
screen_name: string;
|
||||
dv_template_id: number;
|
||||
dv_template_uid: string;
|
||||
layout?: any;
|
||||
}
|
||||
|
||||
@ -210,10 +210,10 @@ export interface DetailViewResponse {
|
||||
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(
|
||||
"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;
|
||||
setLoading(true); setError(null);
|
||||
getDVScreen(viewId)
|
||||
.then(dv => getDetailView(dv.dv_template_id, instanceId))
|
||||
.catch(() => getDetailView(Number(viewId) || 0, instanceId))
|
||||
.then(dv => getDetailView(dv.dv_template_uid, instanceId))
|
||||
.catch(() => getDetailView(viewId, instanceId))
|
||||
.then(res => {
|
||||
setFields(res.config?.fields?.filter((f: any) => f.field_key !== "") ?? []);
|
||||
setData(res.data ?? {});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user