mirror of
https://codeberg.org/tacerus/teddit.git
synced 2024-11-22 14:59:26 +01:00
fix /user/ redirect route
This commit is contained in:
parent
d6e1a98187
commit
cf2fe7f9f1
15
routes.js
15
routes.js
@ -1001,11 +1001,20 @@ module.exports = (app, redis, fetch, RedditAPI) => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
app.get('/user/:user', (req, res, next) => {
|
app.get('/user/:user/:kind?', (req, res, next) => {
|
||||||
res.redirect(`/u/${req.params.user}`)
|
let kind = ''
|
||||||
|
if(req.params.kind)
|
||||||
|
kind = `/${req.params.kind}`
|
||||||
|
let q = ''
|
||||||
|
if(req.query.sort)
|
||||||
|
q += `?sort=${req.query.sort}&`
|
||||||
|
if(req.query.t)
|
||||||
|
q += `t=${req.query.t}`
|
||||||
|
|
||||||
|
res.redirect(`/u/${req.params.user}${kind}${q}`)
|
||||||
})
|
})
|
||||||
|
|
||||||
app.get('/u/:user/:kind?/:sort?', (req, res, next) => {
|
app.get('/u/:user/:kind?', (req, res, next) => {
|
||||||
let user = req.params.user
|
let user = req.params.user
|
||||||
let after = req.query.after
|
let after = req.query.after
|
||||||
let before = req.query.before
|
let before = req.query.before
|
||||||
|
Loading…
Reference in New Issue
Block a user