@arex95/vue-core 1.0.5 → 1.0.6
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.
|
@@ -3,8 +3,7 @@ import { UseQueryOptions } from '@tanstack/vue-query';
|
|
|
3
3
|
/**
|
|
4
4
|
* Creates a fetchComposable for Axios requests with an optional custom instance.
|
|
5
5
|
* @param fetchComposable - The composable to use for the request (can be any fetch function).
|
|
6
|
-
* @param
|
|
7
|
-
* @param axiosInstance - An optional custom Axios instance to use for the request.
|
|
6
|
+
* @param axiosCustomInstance - An optional custom Axios instance to use for the request.
|
|
8
7
|
* @returns A function that handles the request using the provided composable.
|
|
9
8
|
*/
|
|
10
|
-
export declare function createFetch(fetchComposable: Function,
|
|
9
|
+
export declare function createFetch(fetchComposable: Function, axiosCustomInstance?: AxiosInstance): (axiosRequestConfig: AxiosRequestConfig, options?: UseQueryOptions) => any;
|
package/dist/index.mjs
CHANGED
|
@@ -239,15 +239,25 @@ class AxiosService {
|
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
+
let axiosInstance;
|
|
243
|
+
const configureAxios = (baseURL) => {
|
|
244
|
+
axiosInstance = new AxiosService(baseURL);
|
|
245
|
+
};
|
|
246
|
+
const getAxiosInstance = () => {
|
|
247
|
+
if (!axiosInstance) {
|
|
248
|
+
throw new Error('Axios instance not configured. Call configureAxios first.');
|
|
249
|
+
}
|
|
250
|
+
return axiosInstance.getAxiosInstance();
|
|
251
|
+
};
|
|
252
|
+
|
|
242
253
|
/**
|
|
243
254
|
* Creates a fetchComposable for Axios requests with an optional custom instance.
|
|
244
255
|
* @param fetchComposable - The composable to use for the request (can be any fetch function).
|
|
245
|
-
* @param
|
|
246
|
-
* @param axiosInstance - An optional custom Axios instance to use for the request.
|
|
256
|
+
* @param axiosCustomInstance - An optional custom Axios instance to use for the request.
|
|
247
257
|
* @returns A function that handles the request using the provided composable.
|
|
248
258
|
*/
|
|
249
|
-
function createFetch(fetchComposable,
|
|
250
|
-
const instance =
|
|
259
|
+
function createFetch(fetchComposable, axiosCustomInstance) {
|
|
260
|
+
const instance = axiosCustomInstance || getAxiosInstance();
|
|
251
261
|
return (axiosRequestConfig, options) => {
|
|
252
262
|
return fetchComposable(instance, axiosRequestConfig, options);
|
|
253
263
|
};
|
|
@@ -2447,4 +2457,4 @@ function isValidHexNumber(hex) {
|
|
|
2447
2457
|
// console.log(isValidHexNumber('1A3F')); // true
|
|
2448
2458
|
// console.log(isValidHexNumber('GHIJ')); // false
|
|
2449
2459
|
|
|
2450
|
-
export { APP_LOCAL_CACHE_KEY, APP_SESSION_CACHE_KEY, AxiosService, CacheTypeEnum, ContentTypeEnum, ExceptionEnum, FileMetaTypes, ImageTypes, KeyCodeEnum, LOCALE_KEY, LOCK_INFO_KEY, PROJ_CFG_KEY, ROLES_KEY, RestStd, TOKEN_KEY, USER_INFO_KEY, addCustomKeyboardShortcut, addDays, addDoubleClickListener, addKeyListener, ageAtDate, axiosFetch, blobToFormData, bufferToBlob, calculateAge, clickOutside, compareObject, copyToClipboard, countWords, createFetch, createKeyMap, customShortcut, daysBetween, daysToNextBirthday, debounce, debounceAsync, debounceAsyncValidator, debounceAsyncWithImmediate, debounceLeading, debounceLeadingTrailing, debounceTrailing, deepClone, deepEqual, deepMerge, detectKeyHold, disableCopy, disableF12Key, disableMouseButtons, disableRightClick, disableSpecificKeys, downloadBlob, enableMouseButtons, enableRightClick, enableSpecificKeys, exportToCSV, exportToExcel, exportToJSON, exportToText, exportToXML, filterObjectByKeys, flattenObject, formDataToObject, formatDate, generateRandomString, getEndOfMonth, getObjectDifferences, getObjectKeys, getQueryParam, getStartOfMonth, hasNestedProperties, isEmptyObject, isLeapYear, isStrongPassword, isValidAge, isValidCreditCard, isValidDate, isValidEmail, isValidExpiryDate, isValidHexColor, isValidHexColorAlpha, isValidHexNumber, isValidIP, isValidPhoneNumber, isValidSSN, isValidTime, isValidURL, isValidUsername, isValidZIP, lowerFirst, objectToFormData, objectToFormDataEnhanced, objectToQueryString, openWindow, parseDate, proxyToPlainObject, readFileAsDataURL, readFileAsText, registerKeyboardShortcuts, removeAccent, removeClickOutside, removeCustomKeyboardShortcut, removeCustomShortcuts, removeDoubleClickListener, removeEmptyProperties, removeKeyListeners, replaceAll, reverseString, safeGet, screenEnum, screenMap, scrollToTop, simulateKeyPress, sizeEnum, stopDetectingKeyHold, stringToBlob, subtractDays, throttle, toCamelCase, toKebabCase, toggleTabNavigation, truncateString, unregisterKeyboardShortcuts, upperFirst, useBreakpoint, useFilter, usePagination, useSorter, useVueQuery, validateAlphanumeric, validateLetters, validateNumbers };
|
|
2460
|
+
export { APP_LOCAL_CACHE_KEY, APP_SESSION_CACHE_KEY, AxiosService, CacheTypeEnum, ContentTypeEnum, ExceptionEnum, FileMetaTypes, ImageTypes, KeyCodeEnum, LOCALE_KEY, LOCK_INFO_KEY, PROJ_CFG_KEY, ROLES_KEY, RestStd, TOKEN_KEY, USER_INFO_KEY, addCustomKeyboardShortcut, addDays, addDoubleClickListener, addKeyListener, ageAtDate, axiosFetch, blobToFormData, bufferToBlob, calculateAge, clickOutside, compareObject, configureAxios, copyToClipboard, countWords, createFetch, createKeyMap, customShortcut, daysBetween, daysToNextBirthday, debounce, debounceAsync, debounceAsyncValidator, debounceAsyncWithImmediate, debounceLeading, debounceLeadingTrailing, debounceTrailing, deepClone, deepEqual, deepMerge, detectKeyHold, disableCopy, disableF12Key, disableMouseButtons, disableRightClick, disableSpecificKeys, downloadBlob, enableMouseButtons, enableRightClick, enableSpecificKeys, exportToCSV, exportToExcel, exportToJSON, exportToText, exportToXML, filterObjectByKeys, flattenObject, formDataToObject, formatDate, generateRandomString, getAxiosInstance, getEndOfMonth, getObjectDifferences, getObjectKeys, getQueryParam, getStartOfMonth, hasNestedProperties, isEmptyObject, isLeapYear, isStrongPassword, isValidAge, isValidCreditCard, isValidDate, isValidEmail, isValidExpiryDate, isValidHexColor, isValidHexColorAlpha, isValidHexNumber, isValidIP, isValidPhoneNumber, isValidSSN, isValidTime, isValidURL, isValidUsername, isValidZIP, lowerFirst, objectToFormData, objectToFormDataEnhanced, objectToQueryString, openWindow, parseDate, proxyToPlainObject, readFileAsDataURL, readFileAsText, registerKeyboardShortcuts, removeAccent, removeClickOutside, removeCustomKeyboardShortcut, removeCustomShortcuts, removeDoubleClickListener, removeEmptyProperties, removeKeyListeners, replaceAll, reverseString, safeGet, screenEnum, screenMap, scrollToTop, simulateKeyPress, sizeEnum, stopDetectingKeyHold, stringToBlob, subtractDays, throttle, toCamelCase, toKebabCase, toggleTabNavigation, truncateString, unregisterKeyboardShortcuts, upperFirst, useBreakpoint, useFilter, usePagination, useSorter, useVueQuery, validateAlphanumeric, validateLetters, validateNumbers };
|