Skip to content

Commit

Permalink
Always use POST from ui, never PUT (#4010)
Browse files Browse the repository at this point in the history
Aleph supports both POST and PUT for endpoints that modify data, which
are always the same.

Just always send POST from the frontend, so we don't need to add every
Post handler twice. It already uses POST most of the time.
  • Loading branch information
arp242 authored Nov 28, 2024
1 parent c396186 commit 73aaba3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions ui/src/actions/entityActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const createEntity = asyncActionCreator(
const config = { params: { sync: true } };
const payload = entity.toJSON();
payload.collection_id = collection_id;
const response = await endpoint.put(
const response = await endpoint.post(
`entities/${entity.id}`,
payload,
config
Expand All @@ -55,7 +55,7 @@ export const updateEntity = asyncActionCreator(
(entity) => async () => {
const config = { params: { sync: true } };
const payload = entity.toJSON();
const response = await endpoint.put(
const response = await endpoint.post(
`entities/${entity.id}`,
payload,
config
Expand Down
6 changes: 3 additions & 3 deletions ui/src/actions/entityMappingActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const fetchEntityMapping = asyncActionCreator(
);

const executeTrigger = async (collectionId, mappingId) =>
endpoint.put(`collections/${collectionId}/mappings/${mappingId}/trigger`);
endpoint.post(`collections/${collectionId}/mappings/${mappingId}/trigger`);

export const createEntityMapping = asyncActionCreator(
({ id, collection }, mapping) =>
Expand Down Expand Up @@ -51,7 +51,7 @@ export const deleteEntityMapping = asyncActionCreator(
export const flushEntityMapping = asyncActionCreator(
({ id, collection }, mappingId) =>
async () => {
await endpoint.put(
await endpoint.post(
`collections/${collection.id}/mappings/${mappingId}/flush`
);
return { id };
Expand All @@ -62,7 +62,7 @@ export const flushEntityMapping = asyncActionCreator(
export const updateEntityMapping = asyncActionCreator(
({ id, collection }, mappingId, mapping) =>
async () => {
const response = await endpoint.put(
const response = await endpoint.post(
`collections/${collection.id}/mappings/${mappingId}`,
mapping
);
Expand Down
4 changes: 2 additions & 2 deletions ui/src/actions/entitySetActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const createEntitySetNoMutate = asyncActionCreator(createEntitySet, {

export const updateEntitySet = asyncActionCreator(
(entitySetId, entitySet) => async () => {
const response = await endpoint.put(`entitysets/${entitySetId}`, entitySet);
const response = await endpoint.post(`entitysets/${entitySetId}`, entitySet);
return { entitySetId, data: response.data };
},
{ name: 'UPDATE_ENTITYSET' }
Expand All @@ -54,7 +54,7 @@ export const entitySetAddEntity = asyncActionCreator(
async () => {
const config = { params: { sync } };
const payload = entity.toJSON();
const response = await endpoint.put(
const response = await endpoint.post(
`entitysets/${entitySetId}/entities`,
payload,
config
Expand Down

0 comments on commit 73aaba3

Please sign in to comment.