Sha256: 5e6140d7b8d92e5e47e0b96e747dde1de5903bb44f07c98a81b3a892e2bfb58e

Contents?: true

Size: 701 Bytes

Versions: 4

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

4 entries across 4 versions & 1 rubygems

Version Path
kaze-0.4.0 stubs/inertia-common/app/controllers/profile_controller.rb
kaze-0.3.0 stubs/inertia-common/app/controllers/profile_controller.rb
kaze-0.2.0 stubs/default/app/controllers/profile_controller.rb
kaze-0.1.0 stubs/default/app/controllers/profile_controller.rb