Skip to content

Commit

Permalink
Moved logged_in check to Rails filter
Browse files Browse the repository at this point in the history
  • Loading branch information
andrzejkrzywda committed Jan 7, 2024
1 parent 6f1437d commit afb025f
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ class OrdersController < ApplicationController

layout 'client_panel'

def index
before_action :ensure_logged_in

def ensure_logged_in
if ClientOrders::Client.find_by(uid: cookies[:client_id]).nil?
redirect_to logout_path
return
end
end

def index
render html: ClientOrders::OrdersList.build(view_context, cookies[:client_id]), layout: true
end

Expand Down

0 comments on commit afb025f

Please sign in to comment.