mirror of https://github.com/Facinorous-420/dick
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.0 KiB
39 lines
1.0 KiB
import { Request, Response, Router } from "express"
|
|
import { adminCheck, authCheck, wrap } from "../utils/middleware"
|
|
import { TEMPLATE } from "../constants"
|
|
import { Pager } from "../Pager"
|
|
import { parseAuthFile } from "../utils/assJSONStructure"
|
|
|
|
export const userRoutes = (app: Router) => {
|
|
// User Profile
|
|
app.get(
|
|
"/",
|
|
authCheck,
|
|
wrap,
|
|
async (req: Request, res: Response) => {
|
|
await Pager.render(res, req, TEMPLATE.USER, {})
|
|
}
|
|
)
|
|
|
|
// External Viewing Of Other User Profiles (Admin Only)
|
|
/* Currently fucks up the admin route :)
|
|
app.get(
|
|
"/:userID",
|
|
authCheck,
|
|
adminCheck,
|
|
wrap,
|
|
async (req: Request, res: Response) => {
|
|
const allUsers = parseAuthFile()
|
|
const User = allUsers.find((user) => user.username === req.params.userID)
|
|
if (!User) {
|
|
// TODO ADD USER NOT FOUND PAGE FOR THIS ERROR INSTEAD OF SENDING A 404
|
|
return Pager.render(res, req, TEMPLATE.ERRORS[404])
|
|
}
|
|
return Pager.render(res, req, TEMPLATE.USER, {
|
|
params: req.params,
|
|
})
|
|
}
|
|
)
|
|
*/
|
|
}
|