Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 38 additions & 39 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,61 +19,60 @@
"devDependencies": {
"@grafana/eslint-config": "^9.0.0",
"@grafana/tsconfig": "^2.0.1",
"@stylistic/eslint-plugin-ts": "^2.9.0",
"@swc/core": "^1.3.90",
"@swc/helpers": "^0.5.0",
"@swc/jest": "^0.2.26",
"@testing-library/jest-dom": "6.1.4",
"@testing-library/react": "14.0.0",
"@stylistic/eslint-plugin-ts": "^4.4.1",
"@swc/core": "^1.15.11",
"@swc/helpers": "^0.5.18",
"@swc/jest": "^0.2.39",
"@testing-library/jest-dom": "6.9.1",
"@testing-library/react": "16.3.2",
"@testing-library/react-hooks": "^8.0.1",
"@types/jest": "^29.5.0",
"@types/node": "^20.8.7",
"@types/jest": "^30.0.0",
"@types/node": "^25.1.0",
"@types/pubsub-js": "^1.8.3",
"@types/testing-library__jest-dom": "5.14.8",
"@typescript-eslint/eslint-plugin": "^6.18.0",
"@typescript-eslint/parser": "^6.18.0",
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.7.3",
"eslint": "^8.0.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-deprecation": "^2.0.0",
"eslint-plugin-jsdoc": "^46.8.0",
"@typescript-eslint/eslint-plugin": "^8.54.0",
"@typescript-eslint/parser": "^8.54.0",
"copy-webpack-plugin": "^13.0.1",
"css-loader": "^7.1.3",
"eslint": "^9.39.2",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-deprecation": "^3.0.0",
"eslint-plugin-jsdoc": "^62.4.1",
"eslint-plugin-react": "^7.33.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-webpack-plugin": "^4.0.1",
"fork-ts-checker-webpack-plugin": "^8.0.0",
"glob": "^10.2.7",
"eslint-plugin-react-hooks": "^7.0.1",
"eslint-webpack-plugin": "^5.0.2",
"fork-ts-checker-webpack-plugin": "^9.1.0",
"glob": "^13.0.0",
"identity-obj-proxy": "3.0.0",
"imports-loader": "^5.0.0",
"jest": "^29.7.0",
"jest": "^30.2.0",
"jest-environment-jsdom": "30.2.0",
"prettier": "^2.8.7",
"prettier": "^3.8.1",
"replace-in-file-webpack-plugin": "^1.0.6",
"sass": "1.63.2",
"sass-loader": "13.3.1",
"style-loader": "3.3.3",
"swc-loader": "^0.2.3",
"terser-webpack-plugin": "^5.3.10",
"sass": "1.97.3",
"sass-loader": "16.0.6",
"style-loader": "4.0.0",
"swc-loader": "^0.2.7",
"terser-webpack-plugin": "^5.3.16",
"ts-node": "^10.9.2",
"typescript": "5.5.4",
"webpack": "^5.94.0",
"webpack-cli": "^5.1.4",
"typescript": "5.9.3",
"webpack": "^5.104.1",
"webpack-cli": "^6.0.1",
"webpack-livereload-plugin": "^3.0.2",
"webpack-subresource-integrity": "^5.1.0",
"webpack-subresource-integrity": "^5.2.0-rc.1",
"webpack-virtual-modules": "^0.6.2"
},
"engines": {
"node": ">=14"
},
"dependencies": {
"@emotion/css": "11.10.6",
"@grafana/data": "12.2.1",
"@grafana/runtime": "^12.2.1",
"@grafana/schema": "^12.2.1",
"@grafana/ui": "12.2.1",
"@emotion/css": "11.13.5",
"@grafana/data": "12.3.2",
"@grafana/runtime": "^12.3.2",
"@grafana/schema": "^12.3.2",
"@grafana/ui": "12.3.2",
"pubsub-js": "^1.9.4",
"react": "18.2.0",
"react-dom": "18.2.0"
"react": "19.2.4",
"react-dom": "19.2.4"
},
"packageManager": "yarn@1.22.21"
}
12 changes: 6 additions & 6 deletions src/shared/utils/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ type RequestParamType = {
data?: { [key: string]: any };
};

const request = async ({ method, path, baseUrl, data }: RequestParamType) => {
const result = await getBackendSrv().datasourceRequest({
const request = async <T = any>({ method, path, baseUrl, data }: RequestParamType) => {
const result = await getBackendSrv().datasourceRequest<T>({
method,
url: `${baseUrl}/base${path}`,
data,
Expand All @@ -22,10 +22,10 @@ const request = async ({ method, path, baseUrl, data }: RequestParamType) => {
return result;
};

export const Get = async ({ path, baseUrl }: Pick<RequestParamType, 'path' | 'baseUrl'>) => {
return await request({ method: 'GET', path, baseUrl });
export const Get = async <T = any>({ path, baseUrl }: Pick<RequestParamType, 'path' | 'baseUrl'>) => {
return await request<T>({ method: 'GET', path, baseUrl });
};

export const Post = async ({ path, baseUrl, data }: Pick<RequestParamType, 'path' | 'baseUrl' | 'data'>) => {
return await request({ method: 'POST', path, baseUrl, data });
export const Post = async <T = any>({ path, baseUrl, data }: Pick<RequestParamType, 'path' | 'baseUrl' | 'data'>) => {
return await request<T>({ method: 'POST', path, baseUrl, data });
};
Loading
Loading