From d766f74c14ca36e836dbdeee78fb9f08b0ab84c3 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Thu, 20 Jul 2023 20:00:17 +0300 Subject: [PATCH] docs: fix import of authenticate middleware (#4572) * docs: fix import of authenticate middleware * fix eslint errors --- docs/content/development/endpoints/create.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/docs/content/development/endpoints/create.md b/docs/content/development/endpoints/create.md index f089f546ed..c7553939a3 100644 --- a/docs/content/development/endpoints/create.md +++ b/docs/content/development/endpoints/create.md @@ -157,21 +157,22 @@ Protected routes are routes that should be accessible by logged-in customers or ### Protect Store Routes -To make a storefront route protected, first, import the `authenticate-customer` middleware: +To make a storefront route protected, first, import the `authenticateCustomer` middleware: ```ts -import - authenticate -from "@medusajs/medusa/dist/api/middlewares/authenticate-customer" +import { authenticateCustomer } from "@medusajs/medusa" ``` Then, add the middleware to your route: ```ts router.options("/store/hello", cors(corsOptions)) -router.get("/store/hello", cors(corsOptions), authenticate(), +router.get( + "/store/hello", + cors(corsOptions), + authenticateCustomer(), async (req, res) => { if (req.user) { // user is logged in @@ -193,9 +194,7 @@ To make an admin route protected, first, import the `authenticate` middleware: ```ts -import - authenticate -from "@medusajs/medusa/dist/api/middlewares/authenticate" +import { authenticate } from "@medusajs/medusa" ``` Then, add the middleware to your route: