增加getRecordAttachments端点
This commit is contained in:
parent
852a22a3bf
commit
5d828375fb
@ -306,4 +306,28 @@ export async function getSiteSettings() {
|
||||
site_name: "Jsite"
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function getRecordAttachments(pagetype, name) {
|
||||
try {
|
||||
const response = await axios.get(
|
||||
`${BACKEND_SERVER_URL}/api/action/jsite.api.v1.get_record_attachments`,
|
||||
{
|
||||
params: {
|
||||
pagetype,
|
||||
name
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
const message = response.data.message;
|
||||
if (message?.error) {
|
||||
throw new Error(message.error.message || '获取附件失败');
|
||||
}
|
||||
|
||||
return { data: message?.data || [] };
|
||||
} catch (error) {
|
||||
console.error(`Error fetching attachments for ${pagetype}/${name}:`, error.message);
|
||||
return { error: error.message, data: [] };
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user