Skip to content

Commit

Permalink
Use correct post handler for deletion confirmation
Browse files Browse the repository at this point in the history
  • Loading branch information
rcmenno committed Oct 21, 2024
1 parent 4be1904 commit ca94d62
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions PWA/public/RouteEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ RouteEvents.codeInputFound = "/entry.html";
RouteEvents.postCreateDistribution = "/create_distrib";
RouteEvents.postSelectDistribution = "/select_distrib";
RouteEvents.postDeleteDistribution = "/delete_distrib";
RouteEvents.postDeleteDistributionConfirm = "/delete_distrib_confirm";
RouteEvents.listDistributionsFormAction = "/distrib?";
RouteEvents.chooseBeneficiaryCodeInputMethod = "/choose_input_method?";
RouteEvents.selectBeneficiaryCodeInputMethod = "/save_input_method";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { RouteEvents } from "../../RouteEvents.js";
import { ResponseTools } from "../ResponseTools.js";
export class DeleteDistributionsConfirmHandler {
canHandleEvent(event) {
return event.request.url.endsWith(RouteEvents.confirmDistributionDeletion);
return event.request.url.endsWith(RouteEvents.postDeleteDistributionConfirm);
}
async handleEvent(event) {
return await ResponseTools.wrapInHtmlTemplate(RouteEvents.confirmDistributionDeletion);
Expand Down
1 change: 1 addition & 0 deletions PWA/src/RouteEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class RouteEvents {
static postCreateDistribution = "/create_distrib"
static postSelectDistribution = "/select_distrib"
static postDeleteDistribution = "/delete_distrib"
static postDeleteDistributionConfirm = "/delete_distrib_confirm"
static listDistributionsFormAction = "/distrib?"
static chooseBeneficiaryCodeInputMethod = "/choose_input_method?"
static selectBeneficiaryCodeInputMethod = "/save_input_method"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ResponseTools } from "../ResponseTools.js";

export class DeleteDistributionsConfirmHandler implements FetchEventHandler {
canHandleEvent(event: FetchEvent): boolean {
return event.request.url.endsWith(RouteEvents.confirmDistributionDeletion);
return event.request.url.endsWith(RouteEvents.postDeleteDistributionConfirm);
}

async handleEvent(event: FetchEvent): Promise<Response> {
Expand Down

0 comments on commit ca94d62

Please sign in to comment.