Skip to content

Commit

Permalink
feat!: use ky with limited retries instead of axios (#203) (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
hunterckx authored Oct 18, 2024
1 parent 301fa1e commit ec18080
Show file tree
Hide file tree
Showing 15 changed files with 276 additions and 176 deletions.
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: "ts-jest",
preset: "ts-jest/presets/js-with-ts-esm",
testEnvironment: "jest-environment-jsdom",
};
153 changes: 88 additions & 65 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "12.0.0",
"description": "",
"scripts": {
"test": "jest",
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
"lint": "eslint .",
"check-format": "prettier --check .",
"storybook": "storybook dev -p 6006",
Expand Down Expand Up @@ -57,6 +57,7 @@
"husky": "^8.0.3",
"jest": "^29.4.1",
"jest-environment-jsdom": "^29.4.1",
"jest-fetch-mock": "^3.0.3",
"prettier": "^2.8.3",
"prettier-plugin-organize-imports": "^3.2.2",
"storybook": "^7.6.17",
Expand All @@ -70,9 +71,9 @@
"@mui/material": "^6.0.2",
"@tanstack/react-table": "^8.19.2",
"@tanstack/react-virtual": "^3.0.0-beta.59",
"axios": "^1.6.7",
"copy-to-clipboard": "3.3.1",
"isomorphic-dompurify": "0.24.0",
"ky": "^1.7.2",
"next": "^14.1.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
19 changes: 10 additions & 9 deletions src/components/TempError/tempError.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import { AxiosError, isAxiosError } from "axios";
import { HTTPError } from "ky";
import React from "react";
import { ErrorBox } from "./components/errorBox";

interface TempErrorProps {
error: Error | AxiosError;
error: Error | HTTPError;
}

export const TempError = ({ error }: TempErrorProps): JSX.Element => {
const { code, request } = isAxiosError(error)
? {
...error,
code: error.response?.status,
request: error.request.responseURL,
}
: { ...error, code: null, request: null };
const { code, request } =
error instanceof HTTPError
? {
...error,
code: error.response.status,
request: error.response.url,
}
: { ...error, code: null, request: null };

return (
<div>
Expand Down
1 change: 0 additions & 1 deletion src/config/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ export interface DataSourceConfig {
defaultParams?: {
catalog: string;
};
entityURL?: string;
url: string;
}

Expand Down
Loading

0 comments on commit ec18080

Please sign in to comment.