@@ -12,8 +12,8 @@ type RequestParamType = {
1212 data ?: { [ key : string ] : any } ;
1313} ;
1414
15- const request = async ( { method, path, baseUrl, data } : RequestParamType ) => {
16- const result = await getBackendSrv ( ) . datasourceRequest ( {
15+ const request = async < T = any > ( { method, path, baseUrl, data } : RequestParamType ) => {
16+ const result = await getBackendSrv ( ) . datasourceRequest < T > ( {
1717 method,
1818 url : `${ baseUrl } /base${ path } ` ,
1919 data,
@@ -22,10 +22,10 @@ const request = async ({ method, path, baseUrl, data }: RequestParamType) => {
2222 return result ;
2323} ;
2424
25- export const Get = async ( { path, baseUrl } : Pick < RequestParamType , 'path' | 'baseUrl' > ) => {
26- return await request ( { method : 'GET' , path, baseUrl } ) ;
25+ export const Get = async < T = any > ( { path, baseUrl } : Pick < RequestParamType , 'path' | 'baseUrl' > ) => {
26+ return await request < T > ( { method : 'GET' , path, baseUrl } ) ;
2727} ;
2828
29- export const Post = async ( { path, baseUrl, data } : Pick < RequestParamType , 'path' | 'baseUrl' | 'data' > ) => {
30- return await request ( { method : 'POST' , path, baseUrl, data } ) ;
29+ export const Post = async < T = any > ( { path, baseUrl, data } : Pick < RequestParamType , 'path' | 'baseUrl' | 'data' > ) => {
30+ return await request < T > ( { method : 'POST' , path, baseUrl, data } ) ;
3131} ;
0 commit comments