diff --git a/moneymgr_web/src/api/ApiClient.ts b/moneymgr_web/src/api/ApiClient.ts index 49df36b..d8c7c5f 100644 --- a/moneymgr_web/src/api/ApiClient.ts +++ b/moneymgr_web/src/api/ApiClient.ts @@ -66,23 +66,25 @@ export class APIClient { if (args.upProgress) { const res: XMLHttpRequest = await new Promise((resolve, reject) => { const xhr = new XMLHttpRequest(); - xhr.upload.addEventListener("progress", (e) => - { args.upProgress!(e.loaded / e.total); } - ); - xhr.addEventListener("load", () => { resolve(xhr); }); - xhr.addEventListener("error", () => - { reject(new Error("File upload failed")); } - ); - xhr.addEventListener("abort", () => - { reject(new Error("File upload aborted")); } - ); - xhr.addEventListener("timeout", () => - { reject(new Error("File upload timeout")); } - ); + xhr.upload.addEventListener("progress", (e) => { + args.upProgress!(e.loaded / e.total); + }); + xhr.addEventListener("load", () => { + resolve(xhr); + }); + xhr.addEventListener("error", () => { + reject(new Error("File upload failed")); + }); + xhr.addEventListener("abort", () => { + reject(new Error("File upload aborted")); + }); + xhr.addEventListener("timeout", () => { + reject(new Error("File upload timeout")); + }); xhr.open(args.method, url, true); xhr.withCredentials = true; for (const key in headers) { - if (headers.hasOwnProperty(key)) + if (Object.prototype.hasOwnProperty.call(headers, key)) xhr.setRequestHeader(key, headers[key]); } xhr.send(body); diff --git a/moneymgr_web/src/dialogs/CreateTokenDialog.tsx b/moneymgr_web/src/dialogs/CreateTokenDialog.tsx index e28d8bb..f7f12d2 100644 --- a/moneymgr_web/src/dialogs/CreateTokenDialog.tsx +++ b/moneymgr_web/src/dialogs/CreateTokenDialog.tsx @@ -26,7 +26,7 @@ export function CreateTokenDialog(p: { const loadingMessage = useLoadingMessage(); const [newTokenUndef, setNewToken] = React.useState(); - const newToken = newTokenUndef || { + const newToken = newTokenUndef ?? { name: "", ip_net: undefined, max_inactivity: 3600 * 24 * 90, diff --git a/moneymgr_web/src/routes/TokensRoute.tsx b/moneymgr_web/src/routes/TokensRoute.tsx index 01bdb9b..e05ec90 100644 --- a/moneymgr_web/src/routes/TokensRoute.tsx +++ b/moneymgr_web/src/routes/TokensRoute.tsx @@ -200,6 +200,7 @@ function TokensRouteInner(p: { getActions: ({ id }) => { return [ } label="Delete" onClick={handleDeleteClick(id)} diff --git a/moneymgr_web/src/utils/FormUtils.tsx b/moneymgr_web/src/utils/FormUtils.tsx index c5af2ed..95d0742 100644 --- a/moneymgr_web/src/utils/FormUtils.tsx +++ b/moneymgr_web/src/utils/FormUtils.tsx @@ -26,7 +26,7 @@ export function checkConstraint( export function checkURL(s: string): boolean { try { return Boolean(new URL(s)); - } catch (e) { + } catch { return false; } } diff --git a/moneymgr_web/src/widgets/AsyncWidget.tsx b/moneymgr_web/src/widgets/AsyncWidget.tsx index 6c377cc..0dbb13c 100644 --- a/moneymgr_web/src/widgets/AsyncWidget.tsx +++ b/moneymgr_web/src/widgets/AsyncWidget.tsx @@ -17,7 +17,7 @@ export function AsyncWidget(p: { }): React.ReactElement { const [state, setState] = useState(State.Loading); - const counter = useRef(null); + const counter = useRef(null); const load = async () => { try {