smpallen99/coherence

Bug: autogenerated router not valid

StephanMeijer opened this issue · 0 comments

See #339

Autogenerated by mix coh.install:

defmodule Gdss2Web.Router do
  use Gdss2Web.Coherence, :router
  use Coherence.Router         # Add this

  pipeline :browser do
    plug :accepts, ["html"]
    plug :fetch_session
    plug :fetch_flash
    plug :protect_from_forgery
    plug :put_secure_browser_headers
    plug Coherence.Authentication.Session  # Add this
  end

  pipeline :protected do
    plug :accepts, ["html"]
    plug :fetch_session
    plug :fetch_flash
    plug :protect_from_forgery
    plug :put_secure_browser_headers
    plug Coherence.Authentication.Session, protected: true  # Add this
  end

  # Add this block
  scope "/" do
    pipe_through :browser
    coherence_routes()
  end

  # Add this block
  scope "/" do
    pipe_through :protected
    coherence_routes :protected
  end

  scope "/", Gdss2Web do
    pipe_through :browser
    get "/", PageController, :index
    # Add public routes below
  end

  scope "/", Gdss2Web do
    pipe_through :protected
    # Add protected routes below
  end
end

But should be:

defmodule Gdss2Web.Router do
  use Gdss2Web, :router
  use Coherence.Router         # Add this

  pipeline :browser do
    plug :accepts, ["html"]
    plug :fetch_session
    plug :fetch_flash
    plug :protect_from_forgery
    plug :put_secure_browser_headers
    plug Coherence.Authentication.Session  # Add this
  end

  pipeline :protected do
    plug :accepts, ["html"]
    plug :fetch_session
    plug :fetch_flash
    plug :protect_from_forgery
    plug :put_secure_browser_headers
    plug Coherence.Authentication.Session, protected: true  # Add this
  end

  # Add this block
  scope "/" do
    pipe_through :browser
    coherence_routes()
  end

  # Add this block
  scope "/" do
    pipe_through :protected
    coherence_routes :protected
  end

  scope "/", Gdss2Web do
    pipe_through :browser
    get "/", PageController, :index
    # Add public routes below
  end

  scope "/", Gdss2Web do
    pipe_through :protected
    # Add protected routes below
  end
end

Diff:

  use Gdss2Web.Coherence, :router
  use Gdss2Web, :router