class ProfilesController < ApplicationController
  before_action :set_user
  skip_before_action :redirect_accountless

  def show
  end

  def update
    if @user.update(user_params)
      redirect_to profile_path, notice: t(".notice")
    else
      render :show
    end
  end

  private

  def set_user
    @user = authorize current_user, policy_class: ProfilePolicy
  end

  def user_params
    params.require(:user).permit(:first_name, :last_name, :avatar, :time_zone)
  end
end
