fix(medusa): Use correct auth middleware in GET /store/auth (#2687)
* use correct authentication middleware * remove guard from get-session since it's guarded by middleware doing the same check * Add integration tests * Create lazy-swans-agree.md Co-authored-by: olivermrbl <oliver@mrbltech.com> Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
co-authored by
olivermrbl
Oliver Windall Juhl
parent
e18b59de66
commit
70a8d3450f
@@ -48,16 +48,11 @@ import CustomerService from "../../../../services/customer"
|
||||
* $ref: "#/components/responses/500_error"
|
||||
*/
|
||||
export default async (req, res) => {
|
||||
if (req.user && req.user.customer_id) {
|
||||
const customerService: CustomerService =
|
||||
req.scope.resolve("customerService")
|
||||
const customerService: CustomerService = req.scope.resolve("customerService")
|
||||
|
||||
const customer = await customerService.retrieve(req.user.customer_id, {
|
||||
relations: ["shipping_addresses", "orders", "orders.items"],
|
||||
})
|
||||
const customer = await customerService.retrieve(req.user.customer_id, {
|
||||
relations: ["shipping_addresses", "orders", "orders.items"],
|
||||
})
|
||||
|
||||
res.json({ customer })
|
||||
} else {
|
||||
res.sendStatus(401)
|
||||
}
|
||||
res.json({ customer })
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ export default (app) => {
|
||||
|
||||
route.get(
|
||||
"/",
|
||||
middlewares.authenticate(),
|
||||
middlewares.requireCustomerAuthentication(),
|
||||
middlewares.wrap(require("./get-session").default)
|
||||
)
|
||||
route.get("/:email", middlewares.wrap(require("./exists").default))
|
||||
|
||||
Reference in New Issue
Block a user