lkd-web-kit 0.5.7 → 0.5.9
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.cjs
CHANGED
|
@@ -59,7 +59,6 @@ const isInfinityEmpty = require('./utils/isInfinityEmpty.cjs');
|
|
|
59
59
|
const queryStringify = require('./utils/query-stringify.cjs');
|
|
60
60
|
const newRoute = require('./utils/new-route.cjs');
|
|
61
61
|
const virtualStyles = require('./utils/virtual-styles.cjs');
|
|
62
|
-
const showApiErrorNotification = require('./utils/showApiErrorNotification.cjs');
|
|
63
62
|
|
|
64
63
|
|
|
65
64
|
|
|
@@ -128,4 +127,3 @@ exports.createNewRoute = newRoute.createNewRoute;
|
|
|
128
127
|
exports.newRoute = newRoute.newRoute;
|
|
129
128
|
exports.getVirtualContainerProps = virtualStyles.getVirtualContainerProps;
|
|
130
129
|
exports.getVirtualItemProps = virtualStyles.getVirtualItemProps;
|
|
131
|
-
exports.showApiErrorNotification = showApiErrorNotification.showApiErrorNotification;
|
package/dist/index.d.ts
CHANGED
|
@@ -511,8 +511,6 @@ declare type RouteOptions<Query, PathParams> = {
|
|
|
511
511
|
|
|
512
512
|
export declare type Setter<T> = Dispatch<SetStateAction<T>>;
|
|
513
513
|
|
|
514
|
-
export declare const showApiErrorNotification: (error?: unknown, messages?: Partial<Record<HttpStatus, string>>) => never;
|
|
515
|
-
|
|
516
514
|
export declare const shuffleArray: <T>(array: T[]) => T[];
|
|
517
515
|
|
|
518
516
|
declare const stylesBySize: {
|
package/dist/index.js
CHANGED
|
@@ -55,4 +55,3 @@ export { isInfinityEmpty } from './utils/isInfinityEmpty.js';
|
|
|
55
55
|
export { queryStringify } from './utils/query-stringify.js';
|
|
56
56
|
export { createNewRoute, newRoute } from './utils/new-route.js';
|
|
57
57
|
export { getVirtualContainerProps, getVirtualItemProps } from './utils/virtual-styles.js';
|
|
58
|
-
export { showApiErrorNotification } from './utils/showApiErrorNotification.js';
|
package/package.json
CHANGED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
|
|
5
|
-
const notifications = require('@mantine/notifications');
|
|
6
|
-
const ky = require('ky');
|
|
7
|
-
const httpStatus = require('../consts/http-status.cjs');
|
|
8
|
-
|
|
9
|
-
const showApiErrorNotification = (error, messages) => {
|
|
10
|
-
if (error instanceof ky.HTTPError) {
|
|
11
|
-
const fallBackMessage = "Ocurrió un error, por favor intenta de nuevo más tarde";
|
|
12
|
-
const baseMessages = {
|
|
13
|
-
[httpStatus.HttpStatus.Forbidden]: "No tienes permisos para realizar esta acción, contáctate con un administrador",
|
|
14
|
-
[httpStatus.HttpStatus.InternalServerError]: fallBackMessage,
|
|
15
|
-
...messages
|
|
16
|
-
};
|
|
17
|
-
const status = error.response.status;
|
|
18
|
-
const message = baseMessages[status] ?? fallBackMessage;
|
|
19
|
-
notifications.showNotification({
|
|
20
|
-
message,
|
|
21
|
-
color: "red"
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
throw error;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
exports.showApiErrorNotification = showApiErrorNotification;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { showNotification } from '@mantine/notifications';
|
|
2
|
-
import { HTTPError } from 'ky';
|
|
3
|
-
import { HttpStatus } from '../consts/http-status.js';
|
|
4
|
-
|
|
5
|
-
const showApiErrorNotification = (error, messages) => {
|
|
6
|
-
if (error instanceof HTTPError) {
|
|
7
|
-
const fallBackMessage = "Ocurrió un error, por favor intenta de nuevo más tarde";
|
|
8
|
-
const baseMessages = {
|
|
9
|
-
[HttpStatus.Forbidden]: "No tienes permisos para realizar esta acción, contáctate con un administrador",
|
|
10
|
-
[HttpStatus.InternalServerError]: fallBackMessage,
|
|
11
|
-
...messages
|
|
12
|
-
};
|
|
13
|
-
const status = error.response.status;
|
|
14
|
-
const message = baseMessages[status] ?? fallBackMessage;
|
|
15
|
-
showNotification({
|
|
16
|
-
message,
|
|
17
|
-
color: "red"
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
throw error;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export { showApiErrorNotification };
|