module PayoutEntities
  class BaseController < ApplicationController
    protected

    def set_user
      if params[:user_id].present?
        @user = Twitch::User.find params[:user_id]

        if @user.blank?
          flash[:error] = "User not found"
          return redirect_to twitch_users_path
        end

        authorize PayoutEntity
      end
    end
  end
end
