mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 10:28:10 +08:00
chore: struct to wrap with content
This commit is contained in:
@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user