dashboard: add staff vuex store

This commit is contained in:
Dragory 2020-05-23 16:28:05 +03:00
parent d03d729438
commit f90ee12b9f
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
3 changed files with 44 additions and 0 deletions

15
backend/src/api/staff.ts Normal file
View file

@ -0,0 +1,15 @@
import express, { Request, Response } from "express";
import { apiTokenAuthHandlers } from "./auth";
import { isStaff } from "../staff";
export function initStaff(app: express.Express) {
const staffRouter = express.Router();
staffRouter.use(...apiTokenAuthHandlers());
staffRouter.get("/status", (req: Request, res: Response) => {
const userIsStaff = isStaff(req.user.userId);
res.json({ isStaff: userIsStaff });
});
app.use("/staff", staffRouter);
}