fix: callPluginApi unwrap response (TransformInterceptor wrapping)
This commit is contained in:
parent
3451a23e8e
commit
de45ca428b
|
|
@ -162,10 +162,17 @@ export class CoreService {
|
|||
}
|
||||
|
||||
async callPluginApi<T = any>(pluginId: string, path: string, body?: any): Promise<T> {
|
||||
return this.fetchCore(`/api/plugins/rpc/${pluginId}/${path.replace(/^\//, '')}`, {
|
||||
const res = await this.fetchCore(`/api/plugins/rpc/${pluginId}/${path.replace(/^\//, '')}`, {
|
||||
method: 'POST',
|
||||
body: body !== undefined ? JSON.stringify(body) : undefined,
|
||||
});
|
||||
if (res && typeof res === 'object' && res.success === true) {
|
||||
if (res.data && typeof res.data === 'object' && res.data.success === true) {
|
||||
return res.data.data as T;
|
||||
}
|
||||
return res.data as T;
|
||||
}
|
||||
return res as T;
|
||||
}
|
||||
|
||||
async callAsService<T = any>(pluginId: string, path: string, body?: any): Promise<T> {
|
||||
|
|
|
|||
Loading…
Reference in New Issue