Skip to content

Commit

Permalink
fix session not fetched
Browse files Browse the repository at this point in the history
  • Loading branch information
ksevelyar committed Nov 26, 2023
1 parent 8db9d85 commit 45ce01e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/market_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,17 @@ defmodule MarketWeb.Router do

pipeline :api do
plug :accepts, ["json"]
plug :fetch_session
end

pipeline :vendor_api do
plug :accepts, ["json"]
plug :fetch_session
plug :protect_from_forgery
plug :put_secure_browser_headers
plug :fetch_current_vendor
plug :require_authenticated_vendor
end

pipeline :retailer_api do
plug :accepts, ["json"]
plug :fetch_session
plug :protect_from_forgery
plug :put_secure_browser_headers
plug :fetch_current_retailer
Expand All @@ -39,15 +36,15 @@ defmodule MarketWeb.Router do
end

scope "/vendors", MarketWeb.Vendor do
pipe_through [:vendor_api]
pipe_through [:api, :vendor_api]

resources "/products", ProductController, only: [:index, :show, :create, :delete, :update]
resources "/categories", CategoryController, only: [:index, :show, :create, :delete, :update]
resources "/orders", OrderController, only: [:index, :show, :update]
end

scope "/retailers", MarketWeb.Retailer do
pipe_through [:retailer_api]
pipe_through [:api, :retailer_api]

resources "/products", ProductController, only: [:index, :show]
resources "/orders", OrderController, only: [:index, :show, :update, :create, :delete]
Expand Down

0 comments on commit 45ce01e

Please sign in to comment.