Skip to content

Commit

Permalink
[Waste] Don’t call backend APIs for static template calendar page
Browse files Browse the repository at this point in the history
  • Loading branch information
davea authored and dracos committed Oct 1, 2024
1 parent 4b431c7 commit a3b842d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions perllib/FixMyStreet/App/Controller/Waste.pm
Original file line number Diff line number Diff line change
Expand Up @@ -568,9 +568,14 @@ sub csc_payment_failed : Path('csc_payment_failed') : Args(0) {
$c->detach;
}

sub property : Chained('/') : PathPart('waste') : CaptureArgs(1) {
sub property_id : Chained('/') : PathPart('waste') : CaptureArgs(1) {
my ($self, $c, $id) = @_;
$c->stash->{property_id} = $id;
}

sub property : Chained('property_id') : PathPart('') : CaptureArgs(0) {
my ($self, $c) = @_;
my $id = $c->stash->{property_id};

# Some actions chained off /waste/property require user to be logged in.
# The redirect to /auth does not work if it follows the asynchronous
Expand Down Expand Up @@ -670,9 +675,8 @@ sub bin_day_deny : Private {
$c->detach('/page_error_403_access_denied', [ $msg ]);
}

sub calendar : Chained('property') : Args(0) {
sub calendar : Chained('property_id') : Args(0) {
my ($self, $c) = @_;

$c->forward('/about/page', ['waste-calendar']);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[%
PROCESS 'waste/header.html', title = 'Add your waste collection days to your online calendar';
SET ics_link = c.uri_for_action('waste/calendar_ics', [ property.id ]);
SET ics_link = c.uri_for_action('waste/calendar_ics', [ property_id ]);
%]

<script type="module" src="[% version('/vendor/clipboard-copy-element.js') %]"></script>
Expand Down

0 comments on commit a3b842d

Please sign in to comment.