From b3111c95e399ed8c90d3a6659c82bc5f9bdf04ed Mon Sep 17 00:00:00 2001 From: obarykina Date: Mon, 25 Mar 2024 15:08:08 +0300 Subject: [PATCH] apps/web/api/cache: added client queries --- apps/web/api/cache/query.ts | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/apps/web/api/cache/query.ts b/apps/web/api/cache/query.ts index 1526f39..61745b5 100644 --- a/apps/web/api/cache/query.ts +++ b/apps/web/api/cache/query.ts @@ -3,7 +3,13 @@ import getUrls from '@/config/urls'; import { withHandleError } from '@/utils/axios'; import axios from 'axios'; -const { URL_CACHE_GET_QUERIES, URL_CACHE_DELETE_QUERY, URL_CACHE_RESET_QUERIES } = getUrls(); +const { + URL_CACHE_GET_QUERIES, + URL_CACHE_DELETE_QUERY, + URL_CACHE_RESET_QUERIES, + URL_CACHE_DELETE_QUERIES_BY_KEY, + URL_CACHE_GET_QUERY_VALUE, +} = getUrls(); export function getQueries() { return withHandleError(axios.get(URL_CACHE_GET_QUERIES)).then( @@ -24,3 +30,23 @@ export function deleteQuery(queryName: string) { export function reset() { return withHandleError(axios.delete(URL_CACHE_RESET_QUERIES)).then(({ data }) => data); } + +export function deleleteQueriesByKey(queriesGroup: string) { + return withHandleError( + axios.delete(URL_CACHE_DELETE_QUERIES_BY_KEY, { + params: { + queriesGroup, + }, + }) + ).then(({ data }) => data); +} + +export function getQueryValue(queryKey: string) { + return withHandleError( + axios.get(URL_CACHE_GET_QUERY_VALUE, { + params: { + queryKey, + }, + }) + ).then(({ data }) => data); +}