2019-12-10 04:59:35 +00:00
|
|
|
class Api::V1::ProfilesController < Api::BaseController
|
2020-02-16 11:50:38 +00:00
|
|
|
before_action :set_user
|
2019-12-10 04:59:35 +00:00
|
|
|
|
|
|
|
def show
|
2020-05-31 17:40:20 +00:00
|
|
|
render partial: 'api/v1/models/user.json.jbuilder', locals: { resource: @user }
|
2019-12-10 04:59:35 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
|
|
@user.update!(profile_params)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2020-02-16 11:50:38 +00:00
|
|
|
def set_user
|
2019-12-10 04:59:35 +00:00
|
|
|
@user = current_user
|
|
|
|
end
|
|
|
|
|
|
|
|
def profile_params
|
2020-07-04 06:12:47 +00:00
|
|
|
params.require(:profile).permit(:email, :name, :password, :password_confirmation, :avatar, :availability)
|
2019-12-10 04:59:35 +00:00
|
|
|
end
|
|
|
|
end
|