Sha256: 353c5d724510510d023507975481113bff385c3db84e58db8e8be959a690cbcb

Contents?: true

Size: 701 Bytes

Versions: 1

Compression:

Stored size: 701 Bytes

Contents

class ProfileController < ApplicationController
  def edit
    render inertia: 'Profile/Edit', props: {
      status: session[:status]
    }
  end

  def update
    form = UpdateProfileInformationForm.new params.permit(:name, :email)

    return redirect_to profile_edit_path, inertia: { errors: form.error_messages } if form.invalid?

    Current.user.update(name: form.name, email: form.email)

    redirect_to profile_edit_path
  end

  def destroy
    form = DeleteUserForm.new params.permit(:password)

    return redirect_back_or_to profile_edit_path, inertia: { errors: form.error_messages } if form.invalid?

    user = Current.user

    logout

    user.delete

    redirect_to '/'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kaze-0.5.0 stubs/inertia-common/app/controllers/profile_controller.rb