const express = require("express") const router = express.Router() const {generateToken} = require("../graphql") const {fileApi} = require("../../rpdata/api/File") const filesTemplate = require("../../marko/page/data/files.marko") router.get("/", async(req, res) => { let privates = [] if (res.locals.user && res.locals.user.loggedIn) { privates = fileApi.list({public: false}, {token: generateToken(res.locals.user.name)}) } res.markoAsync(filesTemplate, { privates: privates, publics: fileApi.list({public: true}), selected: {files: true}, }) }) module.exports = router