Fixed page breaking if cookie is missing.
This commit is contained in:
parent
24f480d384
commit
bd8976ecf6
|
@ -60,12 +60,14 @@ export default async function initServer() {
|
|||
router.use('/media', express.static(config.media.path));
|
||||
|
||||
router.use((req, res, next) => {
|
||||
if (req.headers.cookie) {
|
||||
const cookies = cookie.parse(req.headers.cookie);
|
||||
|
||||
/* eslint-disable no-param-reassign */
|
||||
req.cookies = cookies;
|
||||
req.tagFilter = cookies.tags ? JSON.parse(cookies.tags) : [];
|
||||
/* eslint-enable no-param-reassign */
|
||||
}
|
||||
|
||||
next();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue