Commit 0bfb9cbf authored by kazubu's avatar kazubu

modify to use redirect_back_or_default function

parent c3d48f97
...@@ -124,11 +124,7 @@ class ProjectsController < ApplicationController ...@@ -124,11 +124,7 @@ class ProjectsController < ApplicationController
::Projects::DestroyService.new(@project, current_user, {}).execute ::Projects::DestroyService.new(@project, current_user, {}).execute
flash[:alert] = "Project '#{@project.name}' was deleted." flash[:alert] = "Project '#{@project.name}' was deleted."
if request.referer.present? && request.referer.include?('/admin') redirect_back_or_default(default: dashboard_projects_path, options: {})
redirect_to admin_namespaces_projects_path
else
redirect_to dashboard_projects_path
end
rescue Projects::DestroyService::DestroyError => ex rescue Projects::DestroyService::DestroyError => ex
redirect_to edit_project_path(@project), alert: ex.message redirect_to edit_project_path(@project), alert: ex.message
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment