/home/vianto5/realtylifestyleproperties.mx/wp-content/plugins/code-snippets/js/utils
NameSizeModeActions
errors.ts800644editdlrm
files.ts11100644editdlrm
general.ts2490644editdlrm
Linter.ts45450644editdlrm
restAPI.ts7930644editdlrm
shortcodes.ts3460644editdlrm
snippets.ts9680644editdlrm
text.ts6230644editdlrm
Edit: /home/vianto5/realtylifestyleproperties.mx/wp-content/plugins/code-snippets/js/utils/restAPI.ts (793B)
import axios from 'axios' import { trimLeadingChar, trimTrailingChar } from './text' import type { AxiosRequestConfig, AxiosResponse } from 'axios' const REST_BASE = window.CODE_SNIPPETS?.restAPI.base ?? '' const getRestUrl = (endpoint: string): string => `${trimTrailingChar(REST_BASE, '/')}/${trimLeadingChar(endpoint, '/')}` const GET_CACHE: Record | undefined> = {} export const getCached = (endpoint: string, refresh = false, config?: AxiosRequestConfig): Promise> => !refresh && GET_CACHE[endpoint] ? Promise.resolve(> GET_CACHE[endpoint]) : axios .get, D>(getRestUrl(endpoint), config) .then(response => { GET_CACHE[endpoint] = response return response })