diff --git a/README.md b/README.md index 393c0d0..92803b4 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ TODO ## Structure ### Database -![database-erm](misc/images//database.png) +![database-erm](misc/images/database.png) ### Backend API endpoints diff --git a/software/backend/routes/account.routes.ts b/software/backend/routes/account.routes.ts index 841e585..a570bbe 100644 --- a/software/backend/routes/account.routes.ts +++ b/software/backend/routes/account.routes.ts @@ -5,7 +5,7 @@ import { validateString } from "../scripts/validateHelper"; export const account = Router() // Login user -account.get("/", (req: Request, res: Response) => { +account.post("/login", (req: Request, res: Response) => { Account.findOne({ raw: true, where: { username: req.body.username } @@ -13,17 +13,17 @@ account.get("/", (req: Request, res: Response) => { .then(account => { if (account != null) { if (account.password == req.body.password) { - // Status: 200 Created - res.status(201).json({ + // Status: 200 OK + res.status(200).json({ loginSuccessful: true, - userId: account.id, + account: account, message: "" }).send() } else { // Status: 401 Unauthorized res.status(401).json({ loginSuccessful: false, - userId: -1, + account: null, message: "Wrong password" }).send() } @@ -40,7 +40,7 @@ account.get("/", (req: Request, res: Response) => { }) // Creating a new user -account.post("/", (req: Request, res: Response) => { +account.post("/register", (req: Request, res: Response) => { if (!validateString(req.body.username, 4)) { // Status: 400 Bad request diff --git a/software/backend/routes/category.routes.ts b/software/backend/routes/category.routes.ts index e941671..4c562ef 100644 --- a/software/backend/routes/category.routes.ts +++ b/software/backend/routes/category.routes.ts @@ -10,7 +10,7 @@ category.get("/", (req: Request, res: Response, next: NextFunction) => { res.status(200).json(categories).send() }) .catch(error => { - res.status(400).json({ message: error }).send() + res.status(400)//.json({ message: error }).send() }) }) diff --git a/software/src/components/alertBanner.vue b/software/src/components/alertBanner.vue index 073b845..b83d2da 100644 --- a/software/src/components/alertBanner.vue +++ b/software/src/components/alertBanner.vue @@ -1,61 +1,20 @@