Commit 08d513a5 authored by Dennis Tang's avatar Dennis Tang

redirect back to form if token expires

parent edb89f55
......@@ -7,17 +7,21 @@ class Projects::Clusters::GcpController < Projects::ApplicationController
helper_method :valid_gcp_token
def create
@cluster = ::Clusters::CreateService
.new(project, current_user, create_params)
.execute(token_in_session)
if valid_gcp_token
@cluster = ::Clusters::CreateService
.new(project, current_user, create_params)
.execute(token_in_session)
if @cluster.persisted?
redirect_to project_cluster_path(project, @cluster)
else
@gcp_cluster = @cluster
user_cluster
if @cluster.persisted?
redirect_to project_cluster_path(project, @cluster)
else
@gcp_cluster = @cluster
user_cluster
render 'projects/clusters/new', locals: { active_tab: 'gcp' }
render 'projects/clusters/new', locals: { active_tab: 'gcp' }
end
else
redirect_to new_project_cluster_path(@project)
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