chore: struct to wrap with content

This commit is contained in:
Joel
2026-01-19 12:19:06 +08:00
parent 021f055c36
commit 245567118c
2 changed files with 14 additions and 5 deletions

View File

@ -100,6 +100,17 @@ export const useGetAppAssetFileContent = (appId: string, nodeId: string) => {
return useQuery({
queryKey: consoleQuery.appAsset.getFileContent.queryKey({ input: { params: { appId, nodeId } } }),
queryFn: () => consoleClient.appAsset.getFileContent({ params: { appId, nodeId } }),
select: (data) => {
try {
const result = JSON.parse(data.content)
return result
}
catch {
return {
content: '',
}
}
},
enabled: !!appId && !!nodeId,
})
}
@ -127,7 +138,7 @@ export const useUpdateAppAssetFileContent = () => {
}) => {
return consoleClient.appAsset.updateFileContent({
params: { appId, nodeId },
body: payload,
body: { content: JSON.stringify(payload) },
})
},
onSuccess: (_, variables) => {