@appcorp/fusion-storybook 0.2.38 → 0.2.40
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.
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Campus Module Cache Utilities
|
|
3
|
-
*
|
|
4
|
-
* Provides localStorage-based caching for campuses using generic cache system.
|
|
5
|
-
*/
|
|
6
|
-
import { CampusBE } from "../../type";
|
|
7
|
-
export declare const getCachedCampusesSync: () => import("@react-pakistan/util-functions").ListResponse<CampusBE>;
|
|
8
|
-
export declare const getCachedCampuses: ({ params, }: {
|
|
9
|
-
params: Record<string, unknown>;
|
|
10
|
-
}) => Promise<import("@react-pakistan/util-functions").ListResponse<CampusBE>>;
|
|
11
|
-
export declare const getCachedCampusById: (campusId: string) => CampusBE | null;
|
|
12
|
-
export declare const invalidateCampusesCache: () => void;
|
|
13
|
-
export declare const isCampusesCacheStale: () => boolean;
|
|
14
|
-
export declare const preloadCampuses: () => Promise<import("@react-pakistan/util-functions").ListResponse<CampusBE>>;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Campus Module Cache Utilities
|
|
3
|
-
*
|
|
4
|
-
* Provides localStorage-based caching for campuses using generic cache system.
|
|
5
|
-
*/
|
|
6
|
-
import { LS_KEYS } from "../../constants";
|
|
7
|
-
import { CAMPUS_API_ROUTES } from "./constants";
|
|
8
|
-
import { getCachedData, getCachedDataSync, getCachedItemById, invalidateCache, isCacheStale, preloadCache, } from "@react-pakistan/util-functions";
|
|
9
|
-
// ============================================================================
|
|
10
|
-
// CACHE CONFIGURATION
|
|
11
|
-
// ============================================================================
|
|
12
|
-
const CAMPUS_CACHE_CONFIG = {
|
|
13
|
-
apiUrl: CAMPUS_API_ROUTES.UNIT,
|
|
14
|
-
cacheKey: LS_KEYS.CAMPUSES,
|
|
15
|
-
};
|
|
16
|
-
// ============================================================================
|
|
17
|
-
// CAMPUS-SPECIFIC CACHE FUNCTIONS
|
|
18
|
-
// ============================================================================
|
|
19
|
-
export const getCachedCampusesSync = () => getCachedDataSync(LS_KEYS.CAMPUSES);
|
|
20
|
-
export const getCachedCampuses = ({ params, }) => getCachedData({
|
|
21
|
-
config: CAMPUS_CACHE_CONFIG,
|
|
22
|
-
params,
|
|
23
|
-
headers: {
|
|
24
|
-
"Content-Type": "application/json",
|
|
25
|
-
// "x-api-token": process.env.NEXT_PUBLIC_API_KEY!,
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
export const getCachedCampusById = (campusId) => getCachedItemById(LS_KEYS.CAMPUSES, campusId);
|
|
29
|
-
export const invalidateCampusesCache = () => invalidateCache(LS_KEYS.CAMPUSES);
|
|
30
|
-
export const isCampusesCacheStale = () => isCacheStale(LS_KEYS.CAMPUSES);
|
|
31
|
-
export const preloadCampuses = () => preloadCache(CAMPUS_CACHE_CONFIG);
|