@algorithm-shift/design-system 1.2.988 → 1.2.990
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +24 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -355,7 +355,12 @@ function useFileService(options) {
|
|
|
355
355
|
withCredentials: true
|
|
356
356
|
});
|
|
357
357
|
setData(result);
|
|
358
|
-
|
|
358
|
+
if (result.status === 200) {
|
|
359
|
+
options?.onSuccess?.(result.data);
|
|
360
|
+
} else {
|
|
361
|
+
const err = new Error(`Fetch failed with status ${result.status}`);
|
|
362
|
+
throw err;
|
|
363
|
+
}
|
|
359
364
|
return result;
|
|
360
365
|
} catch (err) {
|
|
361
366
|
setError(err);
|
|
@@ -375,7 +380,12 @@ function useFileService(options) {
|
|
|
375
380
|
withCredentials: true
|
|
376
381
|
});
|
|
377
382
|
setData(result);
|
|
378
|
-
|
|
383
|
+
if (result.status === 200) {
|
|
384
|
+
options?.onSuccess?.(result.data);
|
|
385
|
+
} else {
|
|
386
|
+
const err = new Error(`Fetch failed with status ${result.status}`);
|
|
387
|
+
throw err;
|
|
388
|
+
}
|
|
379
389
|
return result;
|
|
380
390
|
} catch (err) {
|
|
381
391
|
setError(err);
|
|
@@ -395,7 +405,12 @@ function useFileService(options) {
|
|
|
395
405
|
withCredentials: true
|
|
396
406
|
});
|
|
397
407
|
setData(result);
|
|
398
|
-
|
|
408
|
+
if (result.status === 200) {
|
|
409
|
+
options?.onSuccess?.(result.data);
|
|
410
|
+
} else {
|
|
411
|
+
const err = new Error(`Fetch failed with status ${result.status}`);
|
|
412
|
+
throw err;
|
|
413
|
+
}
|
|
399
414
|
return result;
|
|
400
415
|
} catch (err) {
|
|
401
416
|
setError(err);
|
|
@@ -441,7 +456,10 @@ var ImageControl = ({
|
|
|
441
456
|
axiosInstance: props.axiosInstance,
|
|
442
457
|
apiUrl,
|
|
443
458
|
onSuccess: async (result) => {
|
|
444
|
-
if (!result?.data?.url && !props.onSuccess)
|
|
459
|
+
if (!result?.data?.url && !props.onSuccess) {
|
|
460
|
+
setLoader(false);
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
445
463
|
props.onSuccess?.({ url: result.data.url || "", fileName: result.data.originalname || "" });
|
|
446
464
|
setLoader(false);
|
|
447
465
|
}
|
|
@@ -1946,10 +1964,10 @@ function useLazyDropdown(config) {
|
|
|
1946
1964
|
useEffect14(() => {
|
|
1947
1965
|
if (config.initialData?.length) {
|
|
1948
1966
|
allDataRef.current = config.initialData;
|
|
1949
|
-
loadPage(1, "");
|
|
1950
1967
|
}
|
|
1951
1968
|
}, [config.initialData]);
|
|
1952
1969
|
useEffect14(() => {
|
|
1970
|
+
if (config.fetchOnMount) loadPage(1, "");
|
|
1953
1971
|
return () => {
|
|
1954
1972
|
if (debounceTimer.current) clearTimeout(debounceTimer.current);
|
|
1955
1973
|
};
|
|
@@ -4793,6 +4811,7 @@ function showSonnerToast({
|
|
|
4793
4811
|
onAction
|
|
4794
4812
|
}) {
|
|
4795
4813
|
const options = {
|
|
4814
|
+
closeButton: true,
|
|
4796
4815
|
description,
|
|
4797
4816
|
duration,
|
|
4798
4817
|
action: actionLabel ? {
|