- api to update name and email - api to change password - api to set profile pic - fixes update_attribute! deprecation warning - introducing active storage
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
class Api::V1::ProfilesController < Api::BaseController
|
||||
before_action :fetch_user
|
||||
|
||||
def show
|
||||
render json: @user
|
||||
end
|
||||
|
||||
def update
|
||||
@user.update!(profile_params)
|
||||
render json: @user
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def fetch_user
|
||||
@user = current_user
|
||||
end
|
||||
|
||||
def profile_params
|
||||
params.require(:profile).permit(:email, :name, :password, :password_confirmation, :avatar)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user