strapi-plugin-publisher
Version:
A plugin for Strapi Headless CMS that provides the ability to schedule publishing for any content type.
22 lines (19 loc) • 558 B
text/typescript
import { useFetchClient } from '@strapi/strapi/admin';
import { getPluginEndpointURL } from './getPluginEndpointURL';
// @ts-ignore
export const requestPluginEndpoint = async (endpoint: any, options = {}) => {
const { get, post, put, del } = useFetchClient();
const url = getPluginEndpointURL(endpoint);
// @ts-ignore
switch (options.method?.toUpperCase()) {
case 'POST':
return post(url, options);
case 'PUT':
return put(url, options);
case 'DELETE':
return del(url, options);
case 'GET':
default:
return get(url, options);
}
};