Skip to content

Commit 9533233

Browse files
Added check for new layout param
1 parent 4a45c9e commit 9533233

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

source/routes/stackExchange.route.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ router.get('/', async (req, res) => {
2323
const userId = req.query.userId
2424
const seSite = req.query.seSite
2525
const useImage = req.query.img ? Boolean(req.query.img) : true
26+
const layout = req.query.layout ?? 'full'
2627
const nameX = req.query.nameX || null
2728
const nameSize = req.query.nameSize || 25
2829
let missingInfo = null
@@ -70,6 +71,34 @@ router.get('/', async (req, res) => {
7071
)
7172
}
7273

74+
if (layout) {
75+
missingInfo = [
76+
'layout is incorrect!',
77+
'Allowed values:',
78+
'full, small, mini',
79+
]
80+
81+
switch(layout) {
82+
case 'full':
83+
case 'small':
84+
case 'mini':
85+
break;
86+
default:
87+
88+
return res.send(
89+
SVG(
90+
true,
91+
true,
92+
'Error!',
93+
`
94+
${userError()}
95+
${errorText(missingInfo)}
96+
`,
97+
),
98+
)
99+
}
100+
}
101+
73102
if (!process.env.STACK_EXCHANGE_API_KEY) {
74103
missingInfo = [
75104
'Missing private keys!',

0 commit comments

Comments
 (0)