Changed methods endpoints

This commit is contained in:
DrMint 2023-08-20 16:15:36 +02:00
parent 7912d19129
commit 084e726af7
4 changed files with 5 additions and 5 deletions

View File

@ -30,7 +30,7 @@ export const beforeValidateCheckFileExists: CollectionBeforeValidateHook<File> =
const url = generatePathForFile(type, filename); const url = generatePathForFile(type, filename);
const result = await fetch(url, { method: "HEAD" }); const result = await fetch(url, { method: "head" });
if (result.status !== 200) { if (result.status !== 200) {
throw new Error(`Unable to locate the file at the following address: ${url}`); throw new Error(`Unable to locate the file at the following address: ${url}`);

View File

@ -53,7 +53,7 @@ const importStrapiWordings: typeof importStrapiEntries = async ({
}; };
export const importFromStrapi: CollectionEndpoint = { export const importFromStrapi: CollectionEndpoint = {
method: "get", method: "post",
path: "/strapi", path: "/strapi",
handler: async (req, res) => { handler: async (req, res) => {
if (!req.user) { if (!req.user) {

View File

@ -10,7 +10,7 @@ type Image = {
}; };
export const createImageRegenerationEndpoint = (collection: Collections): CollectionEndpoint => ({ export const createImageRegenerationEndpoint = (collection: Collections): CollectionEndpoint => ({
method: "get", method: "put",
path: "/regenerate", path: "/regenerate",
handler: async (req, res) => { handler: async (req, res) => {
if (!mustBeAdmin(req)) { if (!mustBeAdmin(req)) {

View File

@ -19,7 +19,7 @@ export const getAllStrapiEntries = async <T>(
}); });
const uri = `${process.env.STRAPI_URI}/api/${collectionSlug}?${paramsWithPagination}`; const uri = `${process.env.STRAPI_URI}/api/${collectionSlug}?${paramsWithPagination}`;
const fetchResult = await fetch(uri, { const fetchResult = await fetch(uri, {
method: "GET", method: "get",
headers: { authorization: `Bearer ${process.env.STRAPI_TOKEN}` }, headers: { authorization: `Bearer ${process.env.STRAPI_TOKEN}` },
}); });
const { data, meta } = await fetchResult.json(); const { data, meta } = await fetchResult.json();
@ -78,7 +78,7 @@ export const importStrapiEntries = async <T, S>({
}; };
export const createStrapiImportEndpoint = <T, S>(params: Params<T, S>): CollectionEndpoint => ({ export const createStrapiImportEndpoint = <T, S>(params: Params<T, S>): CollectionEndpoint => ({
method: "get", method: "post",
path: "/strapi", path: "/strapi",
handler: async (req, res) => { handler: async (req, res) => {
if (!req.user) { if (!req.user) {