Hi,

I can't see what I'm doing wrong here, I can't access the id placeholder 
value in my auth sub, can anyone help?

In my startup sub I have:

my $auth = $r->under('/' => sub {
   my $c = shift;
   my $auth_model = App::Models::Auth->new();
    
   if ($auth_model->auth($c)) {
      return 1;
   }
   return 0;
});

$auth->get('/:id')->to('example#index');

In my auth model I have:

sub auth {
  my $self          = shift;
  my $controller = shift;
  my $id             = $controller->param('id'); # I've tried stash too
  
  # To simplifiy I'm just checking if there is an $id but this never 
returns I always get the access_error page
  return 1 if $id;
   
  $controller->render(template => 'example/access_error', status => 401) if 
!$id;
  return 0;
}

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to