Skip to content

Commit aa11f1e

Browse files
committed
Introduce fetchAPIClient instead of axios
1 parent e5c64ee commit aa11f1e

17 files changed

Lines changed: 492 additions & 421 deletions

jupyterlab/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@
7676
"@types/react-dom": "^18.3.1",
7777
"@types/react-syntax-highlighter": "^15.5.5",
7878
"@types/signals": "^1.0.2",
79-
"axios": "^1.11.0",
8079
"css-loader": "^6.8.1",
8180
"elkjs": "^0.9.1",
8281
"jotai": "^2.12.1",

jupyterlab/yarn.lock

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2751,17 +2751,6 @@ __metadata:
27512751
languageName: node
27522752
linkType: hard
27532753

2754-
"axios@npm:^1.11.0":
2755-
version: 1.11.0
2756-
resolution: "axios@npm:1.11.0"
2757-
dependencies:
2758-
follow-redirects: ^1.15.6
2759-
form-data: ^4.0.4
2760-
proxy-from-env: ^1.1.0
2761-
checksum: 0a33dc600b588bfd3111b198d5985527ed89f722817455d7cdb66c1d055e5f8859cc2bebb7320888957fc8458ebe77d5f83af02af9cd260217c91c4e92b6dfb6
2762-
languageName: node
2763-
linkType: hard
2764-
27652754
"babel-plugin-macros@npm:^3.1.0":
27662755
version: 3.1.0
27672756
resolution: "babel-plugin-macros@npm:3.1.0"
@@ -5362,7 +5351,6 @@ __metadata:
53625351
"@types/react-dom": ^18.3.1
53635352
"@types/react-syntax-highlighter": ^15.5.5
53645353
"@types/signals": ^1.0.2
5365-
axios: ^1.11.0
53665354
css-loader: ^6.8.1
53675355
elkjs: ^0.9.1
53685356
jotai: ^2.12.1

optuna_dashboard/package-lock.json

Lines changed: 0 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

optuna_dashboard/package.json

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,17 @@
1515
},
1616
"author": "Masashi Shibata",
1717
"license": "MIT",
18-
"dependencies": {
19-
},
2018
"devDependencies": {
21-
"@optuna/types": "../tslib/types/",
22-
"@optuna/react": "../tslib/react",
2319
"@babel/core": "^7.23.9",
2420
"@babel/preset-env": "^7.23.9",
21+
"@optuna/react": "../tslib/react",
22+
"@optuna/types": "../tslib/types/",
2523
"@types/node": ">=22.8.0",
26-
"@types/react": "^18.2.55",
24+
"@types/papaparse": "^5.3.14",
2725
"@types/plotly.js": "^2.12.32",
26+
"@types/react": "^18.2.55",
2827
"@types/react-dom": "^18.2.18",
2928
"@types/react-syntax-highlighter": "^15.5.11",
30-
"@types/papaparse": "^5.3.14",
3129
"@types/three": "^0.160.0",
3230
"compression-webpack-plugin": "^11.0.0",
3331
"css-loader": "^6.9.1",
@@ -39,25 +37,24 @@
3937
"webpack-cli": "^5.1.4"
4038
},
4139
"peerDependencies": {
42-
"react": ">=16.0.0",
43-
"react-dom": ">=16.0.0",
4440
"@emotion/react": ">=11.0.0",
4541
"@emotion/styled": ">=11.0.0",
4642
"@mui/icons-material": ">=6.0.0",
4743
"@mui/lab": ">=6.0.0-beta.0",
4844
"@mui/material": ">=6.0.0",
4945
"@mui/system": ">=6.0.0",
50-
"plotly.js-dist-min": ">=2.0.0",
5146
"@react-three/drei": ">=9.0.0",
5247
"@react-three/fiber": ">=8.0.0",
53-
"@tanstack/react-table": ">=8.0.0",
5448
"@tanstack/react-query": ">=5.0.0",
49+
"@tanstack/react-table": ">=8.0.0",
5550
"@tanstack/react-virtual": ">=3.0.0",
56-
"axios": ">=1.0.0",
5751
"elkjs": ">=0.8.0",
5852
"jotai": "^2.12.1",
5953
"notistack": ">=3.0.0",
6054
"papaparse": ">=5.0.0",
55+
"plotly.js-dist-min": ">=2.0.0",
56+
"react": ">=16.0.0",
57+
"react-dom": ">=16.0.0",
6158
"react-markdown": ">=9.0.0",
6259
"react-router-dom": ">=6.0.0",
6360
"react-syntax-highlighter": ">=15.0.0",

optuna_dashboard/ts/apiClient.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,28 @@ export type ReGeneratePlotlyGraphQueryResponse = {
177177
re_generated_plotly_graph_func_str: string
178178
}
179179

180+
export class FetchAPIClientError<T = unknown> extends Error {
181+
response?: {
182+
status: number
183+
data: T
184+
}
185+
186+
constructor(message: string, status?: number, data?: T) {
187+
super(message)
188+
this.name = "FetchAPIClientError"
189+
if (status !== undefined && data !== undefined) {
190+
this.response = {
191+
status,
192+
data,
193+
}
194+
}
195+
}
196+
}
197+
198+
export const isFetchAPIClientError = <T = unknown>(
199+
error: unknown
200+
): error is FetchAPIClientError<T> => error instanceof FetchAPIClientError
201+
180202
export abstract class APIClient {
181203
constructor() {}
182204

0 commit comments

Comments
 (0)