summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2025-04-23 22:02:42 -0400
committerOwen Jacobson <owen@grimoire.ca>2025-04-23 22:02:42 -0400
commit4d6cc62f0c9bb5d50720c83fb1ecbd0889d2acd3 (patch)
tree36bfa8ba7a4e55a66154c504510e80450e0b5171 /ui
parent40b91af8007dd0a5d180eba37a8168ca12e013e2 (diff)
Naming improvements c/o Kit
Diffstat (limited to 'ui')
-rw-r--r--ui/lib/apiServer.js3
-rw-r--r--ui/lib/retry.js6
2 files changed, 5 insertions, 4 deletions
diff --git a/ui/lib/apiServer.js b/ui/lib/apiServer.js
index 7edddc3..cad8997 100644
--- a/ui/lib/apiServer.js
+++ b/ui/lib/apiServer.js
@@ -1,6 +1,7 @@
import axios from 'axios';
import * as r from './retry.js';
+import { timedDelay } from './retry.js';
export const apiServer = axios.create({
baseURL: '/api/'
@@ -70,7 +71,7 @@ export class LoggedOut extends Error {}
export class SetupRequired extends Error {}
export async function retry(op) {
- return await r.retry(op, isRetryable, r.delay(5000));
+ return await r.retry(op, isRetryable, r.timedDelay(5000));
}
function responseError(err) {
diff --git a/ui/lib/retry.js b/ui/lib/retry.js
index 777f1be..a2cff65 100644
--- a/ui/lib/retry.js
+++ b/ui/lib/retry.js
@@ -1,9 +1,9 @@
-export async function retry(callback, retryCond, delay) {
+export async function retry(callback, shouldRetry, delay) {
while (true) {
try {
return await callback();
} catch (err) {
- if (retryCond(err)) {
+ if (shouldRetry(err)) {
await delay();
} else {
throw err;
@@ -12,7 +12,7 @@ export async function retry(callback, retryCond, delay) {
}
}
-export function delay(millis) {
+export function timedDelay(millis) {
return async () => await sleep(millis);
}