This commit is contained in:
olivermrbl
2021-08-26 13:57:30 +02:00
parent 5150a6b4d9
commit b1132eec23
2 changed files with 25 additions and 36 deletions
@@ -0,0 +1,25 @@
import { Router } from "express"
import bodyParser from "body-parser"
import jwt from "jsonwebtoken"
const app = Router()
export default () => {
app.get("/wishlists/:token", bodyParser.json(), async (req, res) => {
const { token } = req.params
const JWT_SECRET = process.env.JWT_SECRET || ""
// decorde token with decode = jwt.decode(token, secret)
const decode = jwt.decode(token, JWT_SECRET)
console.log(decode)
// fetch customer.retrieve(decode.customer_id)
// get customer.metadata.wishlist
// respond with
// wishlist
// first_name
res.sendStatus(200)
})
return app
}