diff options
author | Daniel Friesel <derf@finalrewind.org> | 2023-01-21 08:36:25 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2023-01-21 08:36:25 +0100 |
commit | 3e2491a9bc6579ccf017f0dbc2573b5ab4c75613 (patch) | |
tree | fe2e0af05dacc9b51aad3ceee7121471012d8cc4 /lib/Travelynx/Controller/Api.pm | |
parent | 72c50a7cc8fea6942a000d3f8f40bb31ee968ba3 (diff) |
API documentation: do not perform database requests from template helpers
Diffstat (limited to 'lib/Travelynx/Controller/Api.pm')
-rwxr-xr-x | lib/Travelynx/Controller/Api.pm | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Travelynx/Controller/Api.pm b/lib/Travelynx/Controller/Api.pm index 8c47e9f..856c477 100755 --- a/lib/Travelynx/Controller/Api.pm +++ b/lib/Travelynx/Controller/Api.pm @@ -34,7 +34,16 @@ sub sanitize { sub documentation { my ($self) = @_; - $self->render('api_documentation'); + if ( $self->is_user_authenticated ) { + $self->render( + 'api_documentation', + uid => $self->current_user->{id}, + api_token => $self->get_api_token, + ); + } + else { + $self->render('api_documentation'); + } } sub get_v1 { |