X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=ui%2Fweb%2Fsrc%2Fcomposables%2FUtils.ts;h=9e1277a84beaeea04d35c0ec4bcc6fd749a8b79c;hb=3d20f4db7cad24703c7acac80f01ab4c6908ce58;hp=93499abce4e42398b1f7d499281494da136d3684;hpb=f3095697dad156dcb13ea8247a16eb08ca007e6b;p=e-mobility-charging-stations-simulator.git diff --git a/ui/web/src/composables/Utils.ts b/ui/web/src/composables/Utils.ts index 93499abc..9e1277a8 100644 --- a/ui/web/src/composables/Utils.ts +++ b/ui/web/src/composables/Utils.ts @@ -1,5 +1,3 @@ -import util from 'node:util'; - const isUndefined = (value: unknown): boolean => { return typeof value === 'undefined'; }; @@ -20,10 +18,6 @@ export const ifUndefined = (value: T | undefined, isValue: T): T => { // if (isIterable(obj) === false) cb(); // }; -const isPromisePending = (promise: Promise): boolean => { - return util.inspect(promise).includes('pending'); -}; - export const promiseWithTimeout = ( promise: Promise, timeoutMs: number, @@ -35,10 +29,9 @@ export const promiseWithTimeout = ( // Create a timeout promise that rejects in timeout milliseconds const timeoutPromise = new Promise((_, reject) => { setTimeout(() => { - if (isPromisePending(promise)) { - timeoutCallback(); - // FIXME: The original promise shall be canceled - } + // FIXME: The original promise state shall be checked + timeoutCallback(); + // FIXME: The original promise shall be canceled reject(timeoutError); }, timeoutMs); });