dashpresshq/dashpress

View on GitHub
src/frontend/lib/data/constants/getQueryCacheKey.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import type { IPaginatedDataState } from "@/shared/types/data";

export const getQueryCachekey = (endPoint: string) =>
  endPoint
    ?.replace("?", "/")
    .split("/")
    .filter((x) => x);

export const getPaginatedDataCachekey = (
  endPoint: string,
  dataState: IPaginatedDataState<unknown>
) => [...getQueryCachekey(endPoint), JSON.stringify(dataState)];