Skip to content

Commit

Permalink
♻️ [#558] Use POST endpoint to queue destruction
Browse files Browse the repository at this point in the history
  • Loading branch information
SilviaAmAm committed Dec 20, 2024
1 parent 98df3f6 commit 327149f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
6 changes: 3 additions & 3 deletions frontend/.storybook/mockData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ export const MOCKS = {
status: "200",
response: FIXTURE_DESTRUCTION_LIST,
},
DESTRUCTION_LIST_DELETE: {
url: "http://localhost:8000/api/v1/destruction-lists/00000000-0000-0000-0000-000000000000", // FIXME
method: "DELETE",
DESTRUCTION_LIST_QUEUE_DESTRUCTION: {
url: "http://localhost:8000/api/v1/destruction-lists/00000000-0000-0000-0000-000000000000/queue_destruction/",
method: "POST",
status: "200",
response: {},
},
Expand Down
7 changes: 3 additions & 4 deletions frontend/src/lib/api/destructionLists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,12 @@ export async function markDestructionListAsFinal(
*/
export async function destroyDestructionList(uuid: string) {
const response = await request(
"DELETE",
`/destruction-lists/${uuid}/`,
"POST",
`/destruction-lists/${uuid}/queue_destruction/`,
{},
{ uuid },
);
// Check if the response is a 201 Created status code.
if (response.status === 204) {
if (response.status === 200) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
import { clearZaakSelection } from "../../../lib/zaakSelection/zaakSelection";

export type UpdateDestructionListAction<P = JsonValue> = TypedAction<
| "DESTROY"
| "QUEUE_DESTRUCTION"
| "CANCEL_DESTROY"
| "MAKE_FINAL"
| "PROCESS_REVIEW"
Expand All @@ -36,7 +36,7 @@ export async function destructionListUpdateAction({
const action = data as UpdateDestructionListAction<unknown>;

switch (action.type) {
case "DESTROY":
case "QUEUE_DESTRUCTION":
return await destructionListDestroyAction({ request, params });
case "MAKE_FINAL":
return await destructionListMakeFinalAction({ request, params });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ export function useSecondaryNavigation(): ToolbarItem[] {
*/
const handleDestroy = async () => {
submitAction({
type: "DESTROY",
type: "QUEUE_DESTRUCTION",
payload: {
uuid: destructionList.uuid,
},
Expand Down

0 comments on commit 327149f

Please sign in to comment.