Create OrdersPage, load orders from backend, move NavDrawer items to Component
This commit is contained in:
@@ -1,12 +1,18 @@
|
||||
import { Router, Request, Response, NextFunction } from "express";
|
||||
import { Order } from "../models/order.model";
|
||||
import { Product } from "../models/product.model";
|
||||
import { OrderItem } from "../models/orderItem.model";
|
||||
|
||||
export const order = Router()
|
||||
|
||||
order.get("/", (req: Request, res: Response, next: NextFunction) => {
|
||||
Order.findAll()
|
||||
Order.findAll({
|
||||
where: { accountId: req.query.accountId },
|
||||
include: [
|
||||
{ model: OrderItem, include: [ Product ] }
|
||||
]
|
||||
})
|
||||
.then(orders => {
|
||||
res.json(orders)
|
||||
res.send(orders)
|
||||
})
|
||||
.catch(next)
|
||||
})
|
||||
Reference in New Issue
Block a user