SILENT KILLERPanel

Current Path: > home > codekrsu > > shopceylon.store > wp-content > plugins > code-snippets > js > > utils


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: /home/codekrsu//shopceylon.store/wp-content/plugins/code-snippets/js//utils

NameTypeSizeLast ModifiedActions
Linter.ts File 4545 bytes February 14 2025 13:16:14.
errors.ts File 80 bytes November 27 2024 21:52:46.
files.ts File 1110 bytes November 27 2024 21:28:50.
general.ts File 249 bytes November 27 2024 21:28:50.
restAPI.ts File 793 bytes February 14 2025 13:16:14.
shortcodes.ts File 346 bytes May 19 2023 18:41:32.
snippets.ts File 968 bytes November 27 2024 21:28:50.
text.ts File 623 bytes February 14 2025 13:16:14.

Reading File: /home/codekrsu//shopceylon.store/wp-content/plugins/code-snippets/js//utils/restAPI.ts

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<string, AxiosResponse<unknown> | undefined> = {}

export const getCached = <T, D>(endpoint: string, refresh = false, config?: AxiosRequestConfig<D>): Promise<AxiosResponse<T, D>> =>
	!refresh && GET_CACHE[endpoint]
		? Promise.resolve(<AxiosResponse<T, D>> GET_CACHE[endpoint])
		: axios
			.get<T, AxiosResponse<T, D>, D>(getRestUrl(endpoint), config)
			.then(response => {
				GET_CACHE[endpoint] = response
				return response
			})

SILENT KILLER Tool