@wbsuite/react-hooks 1.0.212 → 1.0.213
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/cjs/hooks/useAgents/index.d.ts +2 -0
- package/cjs/hooks/useAgents/index.js +32 -0
- package/cjs/hooks/useApps/index.d.ts +2 -0
- package/cjs/hooks/useApps/index.js +32 -0
- package/cjs/hooks/useArticles/index.d.ts +5 -0
- package/cjs/hooks/useArticles/index.js +45 -0
- package/cjs/hooks/useAttributes/index.d.ts +2 -0
- package/cjs/hooks/useAttributes/index.js +52 -0
- package/cjs/hooks/useAttributesGroups/index.d.ts +3 -0
- package/cjs/hooks/useAttributesGroups/index.js +47 -0
- package/cjs/hooks/useAutomations/index.d.ts +2 -0
- package/cjs/hooks/useAutomations/index.js +32 -0
- package/cjs/hooks/useBackend/get.d.ts +2 -0
- package/cjs/hooks/useBackend/get.js +52 -0
- package/cjs/hooks/useBackend/index.d.ts +17 -0
- package/cjs/hooks/useBackend/index.js +22 -0
- package/cjs/hooks/useBackend/list.d.ts +2 -0
- package/cjs/hooks/useBackend/list.js +55 -0
- package/cjs/hooks/useBackend/post.d.ts +2 -0
- package/cjs/hooks/useBackend/post.js +52 -0
- package/cjs/hooks/useBackend/put.d.ts +2 -0
- package/cjs/hooks/useBackend/put.js +52 -0
- package/cjs/hooks/useCampaigns/index.d.ts +2 -0
- package/cjs/hooks/useCampaigns/index.js +35 -0
- package/cjs/hooks/useCategories/index.d.ts +3 -0
- package/cjs/hooks/useCategories/index.js +9 -0
- package/cjs/hooks/useChats/index.d.ts +3 -0
- package/cjs/hooks/useChats/index.js +37 -0
- package/cjs/hooks/useContactGroups/index.d.ts +3 -0
- package/cjs/hooks/useContactGroups/index.js +57 -0
- package/cjs/hooks/useContacts/index.d.ts +3 -0
- package/cjs/hooks/useContacts/index.js +52 -0
- package/cjs/hooks/useCurrencies/index.d.ts +3 -0
- package/cjs/hooks/useCurrencies/index.js +37 -0
- package/cjs/hooks/useCustomers/index.d.ts +3 -0
- package/cjs/hooks/useCustomers/index.js +52 -0
- package/cjs/hooks/useDocuments/index.d.ts +10 -0
- package/cjs/hooks/useDocuments/index.js +145 -0
- package/cjs/hooks/useDomains/index.d.ts +2 -0
- package/cjs/hooks/useDomains/index.js +32 -0
- package/cjs/hooks/useEmailTemplates/index.d.ts +2 -0
- package/cjs/hooks/useEmailTemplates/index.js +37 -0
- package/cjs/hooks/useEntityStatuses/index.d.ts +2 -0
- package/cjs/hooks/useEntityStatuses/index.js +34 -0
- package/cjs/hooks/useFormSubmissions/index.d.ts +2 -0
- package/cjs/hooks/useFormSubmissions/index.js +9 -0
- package/cjs/hooks/useForms/index.d.ts +2 -0
- package/cjs/hooks/useForms/index.js +37 -0
- package/cjs/hooks/useIntegrations/index.d.ts +2 -0
- package/cjs/hooks/useIntegrations/index.js +39 -0
- package/cjs/hooks/useInvites/index.d.ts +2 -0
- package/cjs/hooks/useInvites/index.js +47 -0
- package/cjs/hooks/useLabels/index.d.ts +3 -0
- package/cjs/hooks/useLabels/index.js +32 -0
- package/cjs/hooks/useLanguages/index.d.ts +5 -0
- package/cjs/hooks/useLanguages/index.js +39 -0
- package/cjs/hooks/useLeads/index.d.ts +30 -0
- package/cjs/hooks/useLeads/index.js +113 -0
- package/cjs/hooks/useMedia/index.d.ts +2 -0
- package/cjs/hooks/useMedia/index.js +34 -0
- package/cjs/hooks/useOrders/index.d.ts +2 -0
- package/cjs/hooks/useOrders/index.js +76 -0
- package/cjs/hooks/usePaths/index.d.ts +2 -0
- package/cjs/hooks/usePaths/index.js +37 -0
- package/cjs/hooks/usePermissions/index.d.ts +2 -0
- package/cjs/hooks/usePermissions/index.js +47 -0
- package/cjs/hooks/useProducts/index.d.ts +2 -0
- package/cjs/hooks/useProducts/index.js +52 -0
- package/cjs/hooks/useProfile/index.d.ts +3 -0
- package/cjs/hooks/useProfile/index.js +57 -0
- package/cjs/hooks/useRenting/index.d.ts +47 -0
- package/cjs/hooks/useRenting/index.js +52 -0
- package/cjs/hooks/useRoles/index.d.ts +2 -0
- package/cjs/hooks/useRoles/index.js +32 -0
- package/cjs/hooks/useRoom/index.d.ts +3 -0
- package/cjs/hooks/useRoom/index.js +55 -0
- package/cjs/hooks/useRotations/index.d.ts +2 -0
- package/cjs/hooks/useRotations/index.js +37 -0
- package/cjs/hooks/useSiteConfig/index.d.ts +5 -0
- package/cjs/hooks/useSiteConfig/index.js +33 -0
- package/cjs/hooks/useStatuses/index.d.ts +2 -0
- package/cjs/hooks/useStatuses/index.js +32 -0
- package/cjs/hooks/useStock/index.d.ts +20 -0
- package/cjs/hooks/useStock/index.js +51 -0
- package/cjs/hooks/useStores/index.d.ts +3 -0
- package/cjs/hooks/useStores/index.js +62 -0
- package/cjs/hooks/useSubscriptions/index.d.ts +2 -0
- package/cjs/hooks/useSubscriptions/index.js +37 -0
- package/cjs/hooks/useTable/index.d.ts +3 -0
- package/cjs/hooks/useTable/index.js +34 -0
- package/cjs/hooks/useTeams/index.d.ts +5 -0
- package/cjs/hooks/useTeams/index.js +52 -0
- package/cjs/hooks/useTickets/index.d.ts +3 -0
- package/cjs/hooks/useTickets/index.js +47 -0
- package/cjs/hooks/useTransactions/index.d.ts +8 -0
- package/cjs/hooks/useTransactions/index.js +61 -0
- package/cjs/hooks/useTranslations/index.d.ts +5 -0
- package/cjs/hooks/useTranslations/index.js +42 -0
- package/cjs/hooks/useUserConnections/index.d.ts +2 -0
- package/cjs/hooks/useUserConnections/index.js +53 -0
- package/cjs/hooks/useUserSubscriptions/index.d.ts +6 -0
- package/cjs/hooks/useUserSubscriptions/index.js +47 -0
- package/cjs/hooks/useUsers/index.d.ts +17 -0
- package/cjs/hooks/useUsers/index.js +141 -0
- package/cjs/hooks/useWBSuite/index.d.ts +2 -0
- package/cjs/hooks/useWBSuite/index.js +39 -0
- package/cjs/hooks/useWebsites/index.d.ts +2 -0
- package/cjs/hooks/useWebsites/index.js +72 -0
- package/{src/index.ts → cjs/index.d.ts} +1 -1
- package/cjs/index.js +119 -0
- package/cjs/models/Requestor.d.ts +24 -0
- package/cjs/models/Requestor.js +53 -0
- package/{src/next/utils/index.ts → cjs/next/utils/index.d.ts} +1 -1
- package/cjs/next/utils/index.js +6 -0
- package/cjs/next/utils/wrapAsync.d.ts +1 -0
- package/cjs/next/utils/wrapAsync.js +54 -0
- package/cjs/utils/authWithApiKey.d.ts +4 -0
- package/cjs/utils/authWithApiKey.js +8 -0
- package/cjs/utils/authWithToken.d.ts +4 -0
- package/cjs/utils/authWithToken.js +8 -0
- package/cjs/utils/index.d.ts +11 -0
- package/cjs/utils/index.js +19 -0
- package/esm/hooks/useAgents/index.d.ts +2 -0
- package/esm/hooks/useAgents/index.js +28 -0
- package/esm/hooks/useApps/index.d.ts +2 -0
- package/esm/hooks/useApps/index.js +28 -0
- package/esm/hooks/useArticles/index.d.ts +5 -0
- package/esm/hooks/useArticles/index.js +40 -0
- package/esm/hooks/useAttributes/index.d.ts +2 -0
- package/esm/hooks/useAttributes/index.js +48 -0
- package/esm/hooks/useAttributesGroups/index.d.ts +3 -0
- package/esm/hooks/useAttributesGroups/index.js +43 -0
- package/esm/hooks/useAutomations/index.d.ts +2 -0
- package/esm/hooks/useAutomations/index.js +28 -0
- package/esm/hooks/useBackend/get.d.ts +2 -0
- package/esm/hooks/useBackend/get.js +48 -0
- package/esm/hooks/useBackend/index.d.ts +17 -0
- package/esm/hooks/useBackend/index.js +18 -0
- package/esm/hooks/useBackend/list.d.ts +2 -0
- package/esm/hooks/useBackend/list.js +51 -0
- package/esm/hooks/useBackend/post.d.ts +2 -0
- package/esm/hooks/useBackend/post.js +48 -0
- package/esm/hooks/useBackend/put.d.ts +2 -0
- package/esm/hooks/useBackend/put.js +48 -0
- package/esm/hooks/useCampaigns/index.d.ts +2 -0
- package/esm/hooks/useCampaigns/index.js +31 -0
- package/esm/hooks/useCategories/index.d.ts +3 -0
- package/esm/hooks/useCategories/index.js +5 -0
- package/esm/hooks/useChats/index.d.ts +3 -0
- package/esm/hooks/useChats/index.js +33 -0
- package/esm/hooks/useContactGroups/index.d.ts +3 -0
- package/esm/hooks/useContactGroups/index.js +53 -0
- package/esm/hooks/useContacts/index.d.ts +3 -0
- package/esm/hooks/useContacts/index.js +48 -0
- package/esm/hooks/useCurrencies/index.d.ts +3 -0
- package/esm/hooks/useCurrencies/index.js +33 -0
- package/esm/hooks/useCustomers/index.d.ts +3 -0
- package/esm/hooks/useCustomers/index.js +48 -0
- package/esm/hooks/useDocuments/index.d.ts +10 -0
- package/esm/hooks/useDocuments/index.js +141 -0
- package/esm/hooks/useDomains/index.d.ts +2 -0
- package/esm/hooks/useDomains/index.js +28 -0
- package/esm/hooks/useEmailTemplates/index.d.ts +2 -0
- package/esm/hooks/useEmailTemplates/index.js +33 -0
- package/esm/hooks/useEntityStatuses/index.d.ts +2 -0
- package/esm/hooks/useEntityStatuses/index.js +30 -0
- package/esm/hooks/useFormSubmissions/index.d.ts +2 -0
- package/esm/hooks/useFormSubmissions/index.js +5 -0
- package/esm/hooks/useForms/index.d.ts +2 -0
- package/esm/hooks/useForms/index.js +33 -0
- package/esm/hooks/useIntegrations/index.d.ts +2 -0
- package/esm/hooks/useIntegrations/index.js +35 -0
- package/esm/hooks/useInvites/index.d.ts +2 -0
- package/esm/hooks/useInvites/index.js +43 -0
- package/esm/hooks/useLabels/index.d.ts +3 -0
- package/esm/hooks/useLabels/index.js +28 -0
- package/esm/hooks/useLanguages/index.d.ts +5 -0
- package/esm/hooks/useLanguages/index.js +35 -0
- package/esm/hooks/useLeads/index.d.ts +30 -0
- package/esm/hooks/useLeads/index.js +109 -0
- package/esm/hooks/useMedia/index.d.ts +2 -0
- package/esm/hooks/useMedia/index.js +30 -0
- package/esm/hooks/useOrders/index.d.ts +2 -0
- package/esm/hooks/useOrders/index.js +72 -0
- package/esm/hooks/usePaths/index.d.ts +2 -0
- package/esm/hooks/usePaths/index.js +33 -0
- package/esm/hooks/usePermissions/index.d.ts +2 -0
- package/esm/hooks/usePermissions/index.js +43 -0
- package/esm/hooks/useProducts/index.d.ts +2 -0
- package/esm/hooks/useProducts/index.js +48 -0
- package/esm/hooks/useProfile/index.d.ts +3 -0
- package/esm/hooks/useProfile/index.js +53 -0
- package/esm/hooks/useRenting/index.d.ts +47 -0
- package/esm/hooks/useRenting/index.js +48 -0
- package/esm/hooks/useRoles/index.d.ts +2 -0
- package/esm/hooks/useRoles/index.js +28 -0
- package/esm/hooks/useRoom/index.d.ts +3 -0
- package/esm/hooks/useRoom/index.js +51 -0
- package/esm/hooks/useRotations/index.d.ts +2 -0
- package/esm/hooks/useRotations/index.js +33 -0
- package/esm/hooks/useSiteConfig/index.d.ts +5 -0
- package/esm/hooks/useSiteConfig/index.js +29 -0
- package/esm/hooks/useStatuses/index.d.ts +2 -0
- package/esm/hooks/useStatuses/index.js +28 -0
- package/esm/hooks/useStock/index.d.ts +20 -0
- package/esm/hooks/useStock/index.js +47 -0
- package/esm/hooks/useStores/index.d.ts +3 -0
- package/esm/hooks/useStores/index.js +58 -0
- package/esm/hooks/useSubscriptions/index.d.ts +2 -0
- package/esm/hooks/useSubscriptions/index.js +33 -0
- package/esm/hooks/useTable/index.d.ts +3 -0
- package/esm/hooks/useTable/index.js +30 -0
- package/esm/hooks/useTeams/index.d.ts +5 -0
- package/esm/hooks/useTeams/index.js +48 -0
- package/esm/hooks/useTickets/index.d.ts +3 -0
- package/esm/hooks/useTickets/index.js +43 -0
- package/esm/hooks/useTransactions/index.d.ts +8 -0
- package/esm/hooks/useTransactions/index.js +57 -0
- package/esm/hooks/useTranslations/index.d.ts +5 -0
- package/esm/hooks/useTranslations/index.js +38 -0
- package/esm/hooks/useUserConnections/index.d.ts +2 -0
- package/esm/hooks/useUserConnections/index.js +49 -0
- package/esm/hooks/useUserSubscriptions/index.d.ts +6 -0
- package/esm/hooks/useUserSubscriptions/index.js +43 -0
- package/esm/hooks/useUsers/index.d.ts +17 -0
- package/esm/hooks/useUsers/index.js +137 -0
- package/esm/hooks/useWBSuite/index.d.ts +2 -0
- package/esm/hooks/useWBSuite/index.js +35 -0
- package/esm/hooks/useWebsites/index.d.ts +2 -0
- package/esm/hooks/useWebsites/index.js +68 -0
- package/esm/index.d.ts +51 -0
- package/esm/index.js +52 -0
- package/esm/models/Requestor.d.ts +24 -0
- package/esm/models/Requestor.js +47 -0
- package/esm/next/utils/index.d.ts +2 -0
- package/esm/next/utils/index.js +3 -0
- package/esm/next/utils/wrapAsync.d.ts +1 -0
- package/esm/next/utils/wrapAsync.js +50 -0
- package/esm/utils/authWithApiKey.d.ts +4 -0
- package/esm/utils/authWithApiKey.js +4 -0
- package/esm/utils/authWithToken.d.ts +4 -0
- package/esm/utils/authWithToken.js +4 -0
- package/esm/utils/index.d.ts +11 -0
- package/esm/utils/index.js +3 -0
- package/package.json +1 -1
- package/README.md +0 -66
- package/docs/USAGE.md +0 -107
- package/eslint.config.js +0 -12
- package/src/hooks/useAgents/index.ts +0 -10
- package/src/hooks/useApps/index.ts +0 -10
- package/src/hooks/useArticles/index.ts +0 -18
- package/src/hooks/useAttributes/index.ts +0 -18
- package/src/hooks/useAttributesGroups/index.ts +0 -17
- package/src/hooks/useAutomations/index.ts +0 -10
- package/src/hooks/useBackend/get.ts +0 -6
- package/src/hooks/useBackend/index.ts +0 -40
- package/src/hooks/useBackend/list.ts +0 -6
- package/src/hooks/useBackend/post.ts +0 -6
- package/src/hooks/useBackend/put.ts +0 -6
- package/src/hooks/useCampaigns/index.ts +0 -11
- package/src/hooks/useCategories/index.ts +0 -7
- package/src/hooks/useChats/index.ts +0 -13
- package/src/hooks/useContactGroups/index.ts +0 -28
- package/src/hooks/useContacts/index.ts +0 -21
- package/src/hooks/useCurrencies/index.ts +0 -14
- package/src/hooks/useCustomers/index.ts +0 -21
- package/src/hooks/useDocuments/index.ts +0 -86
- package/src/hooks/useDomains/index.ts +0 -10
- package/src/hooks/useEmailTemplates/index.ts +0 -13
- package/src/hooks/useEntityStatuses/index.ts +0 -13
- package/src/hooks/useFormSubmissions/index.ts +0 -6
- package/src/hooks/useForms/index.ts +0 -16
- package/src/hooks/useIntegrations/index.ts +0 -15
- package/src/hooks/useInvites/index.ts +0 -19
- package/src/hooks/useLabels/index.ts +0 -13
- package/src/hooks/useLanguages/index.ts +0 -16
- package/src/hooks/useLeads/index.ts +0 -149
- package/src/hooks/useMedia/index.ts +0 -13
- package/src/hooks/useOrders/index.ts +0 -74
- package/src/hooks/usePaths/index.ts +0 -16
- package/src/hooks/usePermissions/index.ts +0 -16
- package/src/hooks/useProducts/index.ts +0 -18
- package/src/hooks/useProfile/index.ts +0 -20
- package/src/hooks/useRenting/index.ts +0 -57
- package/src/hooks/useRoles/index.ts +0 -10
- package/src/hooks/useRoom/index.ts +0 -20
- package/src/hooks/useRotations/index.ts +0 -13
- package/src/hooks/useSiteConfig/index.ts +0 -13
- package/src/hooks/useStatuses/index.ts +0 -10
- package/src/hooks/useStock/index.ts +0 -48
- package/src/hooks/useStores/index.ts +0 -23
- package/src/hooks/useSubscriptions/index.ts +0 -17
- package/src/hooks/useTable/index.ts +0 -15
- package/src/hooks/useTeams/index.ts +0 -29
- package/src/hooks/useTickets/index.ts +0 -17
- package/src/hooks/useTransactions/index.ts +0 -43
- package/src/hooks/useTranslations/index.ts +0 -20
- package/src/hooks/useUserConnections/index.ts +0 -18
- package/src/hooks/useUserSubscriptions/index.ts +0 -28
- package/src/hooks/useUsers/index.ts +0 -57
- package/src/hooks/useWBSuite/index.ts +0 -29
- package/src/hooks/useWebsites/index.ts +0 -34
- package/src/models/Requestor.ts +0 -67
- package/src/next/utils/wrapAsync.ts +0 -2
- package/src/utils/authWithApiKey.ts +0 -3
- package/src/utils/authWithToken.ts +0 -3
- package/src/utils/index.ts +0 -7
- package/tsconfig.json +0 -20
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { RequestorOptions } from 'models/Requestor';
|
|
2
|
-
import { BackendHook, useBackend } from '../useBackend';
|
|
3
|
-
|
|
4
|
-
export const useWebsites: BackendHook<Record<string, string>, any> = (auth?: RequestorOptions['auth']) => {
|
|
5
|
-
const { requestor, ...rest } = useBackend('websites', { auth });
|
|
6
|
-
return {
|
|
7
|
-
...rest,
|
|
8
|
-
requestor,
|
|
9
|
-
getProductSiteById: (siteId: string) => {
|
|
10
|
-
return requestor.makeRequest.get(`websites/product/${siteId}`).then(({ data }) => data);
|
|
11
|
-
},
|
|
12
|
-
getPublicById: (siteId: string) => {
|
|
13
|
-
return requestor.makeRequest.get(`websites/${siteId}/public`).then(({ data }) => data);
|
|
14
|
-
},
|
|
15
|
-
resetApiKey: (siteId: string) => {
|
|
16
|
-
return requestor.makeRequest.put(`websites/${siteId}/apiKey`).then(({ data }) => data);
|
|
17
|
-
},
|
|
18
|
-
expireApiKey: (siteId: string) => {
|
|
19
|
-
return requestor.makeRequest.delete(`websites/${siteId}/apiKey`).then(({ data }) => data);
|
|
20
|
-
},
|
|
21
|
-
getIntegrationDetails: (siteId: string) => {
|
|
22
|
-
return requestor.makeRequest.get(`websites/${siteId}/integrate`).then(({ data }) => data);
|
|
23
|
-
},
|
|
24
|
-
addDomain: (siteId: string, origin: string) => {
|
|
25
|
-
return requestor.makeRequest.post(`websites/${siteId}/domain`, { origin }).then(({ data }) => data);
|
|
26
|
-
},
|
|
27
|
-
removeDomain: (siteId: string) => {
|
|
28
|
-
return requestor.makeRequest.delete(`websites/${siteId}/domain`).then(({ data }) => data);
|
|
29
|
-
},
|
|
30
|
-
duplicateSite: (siteId: string, overrides: { name?: string; description?: string }) => {
|
|
31
|
-
return requestor.makeRequest.post(`websites/${siteId}/duplicate`, overrides).then(({ data }) => data);
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
};
|
package/src/models/Requestor.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { WBBackendConfig } from '@wb/types/backendConfig/backendConfig';
|
|
2
|
-
import axios, { AxiosInstance, AxiosResponse, InternalAxiosRequestConfig } from 'axios';
|
|
3
|
-
import { useWBSuite } from '../hooks/useWBSuite';
|
|
4
|
-
|
|
5
|
-
type Validator = (isCreate: boolean, body: any) => boolean;
|
|
6
|
-
|
|
7
|
-
export type RequestorOptions = {
|
|
8
|
-
auth:
|
|
9
|
-
| { type: 'token' | 'apiKey' } & (
|
|
10
|
-
| { type: 'token'; token: string }
|
|
11
|
-
| { type: 'apiKey'; apiKey: string }
|
|
12
|
-
);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export class Requestor {
|
|
16
|
-
makeRequest: AxiosInstance;
|
|
17
|
-
validateWith?: Validator;
|
|
18
|
-
|
|
19
|
-
constructor(
|
|
20
|
-
config: Partial<WBBackendConfig>,
|
|
21
|
-
validator?: Validator,
|
|
22
|
-
opts: Partial<RequestorOptions> = {}
|
|
23
|
-
) {
|
|
24
|
-
if (!config) {
|
|
25
|
-
useWBSuite();
|
|
26
|
-
}
|
|
27
|
-
this.makeRequest = axios.create({ baseURL: config?.apiURL ?? (globalThis as any).WBSUITE_CONFIG?.apiURL });
|
|
28
|
-
this.validateWith = validator;
|
|
29
|
-
this.makeRequest.interceptors.request.use((requestConfig: InternalAxiosRequestConfig) => {
|
|
30
|
-
if ((opts.auth?.type === 'apiKey' && opts.auth.apiKey) || config?.apiKey) {
|
|
31
|
-
requestConfig.headers['x-api-key'] = (opts.auth?.type === 'apiKey' && opts.auth.apiKey) || config?.apiKey;
|
|
32
|
-
}
|
|
33
|
-
if (opts.auth?.type === 'token' && opts.auth.token) {
|
|
34
|
-
delete requestConfig.headers['x-api-key'];
|
|
35
|
-
requestConfig.headers.Authorization = `Bearer ${opts.auth?.type === 'token' && opts.auth.token}`;
|
|
36
|
-
}
|
|
37
|
-
return requestConfig;
|
|
38
|
-
});
|
|
39
|
-
if (config?.environment === 'development') {
|
|
40
|
-
this.makeRequest.interceptors.response.use(
|
|
41
|
-
(response: AxiosResponse) => {
|
|
42
|
-
console.log(
|
|
43
|
-
`${new Date().toISOString()} [INFO] --- ${response.request.host} ${response.status} ${JSON.stringify(
|
|
44
|
-
response.data
|
|
45
|
-
)}`
|
|
46
|
-
);
|
|
47
|
-
return response;
|
|
48
|
-
},
|
|
49
|
-
(response: AxiosResponse) => {
|
|
50
|
-
console.error(
|
|
51
|
-
`${new Date().toISOString()} [ERROR] --- ${response.request.host} ${response.status} ${JSON.stringify(
|
|
52
|
-
response.data
|
|
53
|
-
)}`
|
|
54
|
-
);
|
|
55
|
-
return Promise.reject(response);
|
|
56
|
-
}
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
public get validate() {
|
|
62
|
-
return {
|
|
63
|
-
create: (body: any) => this.validateWith?.(true, body) ?? true,
|
|
64
|
-
edit: (body: any) => this.validateWith?.(false, body) ?? true,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
}
|
package/src/utils/index.ts
DELETED
package/tsconfig.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"module": "esnext",
|
|
4
|
-
"moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
|
|
5
|
-
"lib": ["es6", "dom", "es2016", "es2017", "es2020"],
|
|
6
|
-
"target": "es5",
|
|
7
|
-
"outDir": "./dist/react-hooks/esm" /* Redirect output structure to the directory. */,
|
|
8
|
-
"baseUrl": "./src" /* Base directory to resolve non-absolute module names. */,
|
|
9
|
-
"declaration": true /* Concatenate and emit output to single file. */,
|
|
10
|
-
"strict": true /* Enable all strict type-checking options. */,
|
|
11
|
-
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
|
|
12
|
-
"inlineSourceMap": true /* Emit a single file with source maps instead of having a separate file. */,
|
|
13
|
-
"inlineSources": true /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */,
|
|
14
|
-
"skipLibCheck": true /* Skip type checking of declaration files. */,
|
|
15
|
-
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
|
|
16
|
-
"allowSyntheticDefaultImports": true
|
|
17
|
-
},
|
|
18
|
-
"include": ["src/**/*.ts", "eslint.config.js"],
|
|
19
|
-
"exclude": ["node_modules", "dist"]
|
|
20
|
-
}
|