diff options
author | Daniel Friesel <derf@finalrewind.org> | 2023-01-22 11:34:53 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2023-01-22 11:34:53 +0100 |
commit | 59e9a24aa63d0209ea301b2c4aa71687e8295be6 (patch) | |
tree | c8ead7e0f04abd4ca4090c59d9c7897ba75134b9 /lib/Travelynx/Controller/Api.pm | |
parent | af82c46d576ac7d24801d1851ebcce1eb97390d5 (diff) |
move get_api_token to users model
Diffstat (limited to 'lib/Travelynx/Controller/Api.pm')
-rwxr-xr-x | lib/Travelynx/Controller/Api.pm | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Travelynx/Controller/Api.pm b/lib/Travelynx/Controller/Api.pm index 856c477..6f788b5 100755 --- a/lib/Travelynx/Controller/Api.pm +++ b/lib/Travelynx/Controller/Api.pm @@ -35,10 +35,11 @@ sub documentation { my ($self) = @_; if ( $self->is_user_authenticated ) { + my $uid = $self->current_user->{id}; $self->render( 'api_documentation', - uid => $self->current_user->{id}, - api_token => $self->get_api_token, + uid => $uid, + api_token => $self->users->get_api_token( uid => $uid ), ); } else { @@ -79,7 +80,7 @@ sub get_v1 { return; } - my $token = $self->get_api_token($uid); + my $token = $self->users->get_api_token( uid => $uid ); if ( not $api_token or not $token->{$api_action} or $api_token ne $token->{$api_action} ) @@ -145,7 +146,7 @@ sub travel_v1 { return; } - my $token = $self->get_api_token($uid); + my $token = $self->users->get_api_token( uid => $uid ); if ( not $token->{'travel'} or $api_token ne $token->{'travel'} ) { $self->render( json => { @@ -411,7 +412,7 @@ sub import_v1 { return; } - my $token = $self->get_api_token($uid); + my $token = $self->users->get_api_token($uid); if ( not $token->{'import'} or $api_token ne $token->{'import'} ) { $self->render( json => { |