Changed methods endpoints
This commit is contained in:
parent
7912d19129
commit
084e726af7
|
@ -30,7 +30,7 @@ export const beforeValidateCheckFileExists: CollectionBeforeValidateHook<File> =
|
|||
|
||||
const url = generatePathForFile(type, filename);
|
||||
|
||||
const result = await fetch(url, { method: "HEAD" });
|
||||
const result = await fetch(url, { method: "head" });
|
||||
|
||||
if (result.status !== 200) {
|
||||
throw new Error(`Unable to locate the file at the following address: ${url}`);
|
||||
|
|
|
@ -53,7 +53,7 @@ const importStrapiWordings: typeof importStrapiEntries = async ({
|
|||
};
|
||||
|
||||
export const importFromStrapi: CollectionEndpoint = {
|
||||
method: "get",
|
||||
method: "post",
|
||||
path: "/strapi",
|
||||
handler: async (req, res) => {
|
||||
if (!req.user) {
|
||||
|
|
|
@ -10,7 +10,7 @@ type Image = {
|
|||
};
|
||||
|
||||
export const createImageRegenerationEndpoint = (collection: Collections): CollectionEndpoint => ({
|
||||
method: "get",
|
||||
method: "put",
|
||||
path: "/regenerate",
|
||||
handler: async (req, res) => {
|
||||
if (!mustBeAdmin(req)) {
|
||||
|
|
|
@ -19,7 +19,7 @@ export const getAllStrapiEntries = async <T>(
|
|||
});
|
||||
const uri = `${process.env.STRAPI_URI}/api/${collectionSlug}?${paramsWithPagination}`;
|
||||
const fetchResult = await fetch(uri, {
|
||||
method: "GET",
|
||||
method: "get",
|
||||
headers: { authorization: `Bearer ${process.env.STRAPI_TOKEN}` },
|
||||
});
|
||||
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 => ({
|
||||
method: "get",
|
||||
method: "post",
|
||||
path: "/strapi",
|
||||
handler: async (req, res) => {
|
||||
if (!req.user) {
|
||||
|
|
Loading…
Reference in New Issue