-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
MWM-Shop_Project/src/handler.js
Line 208 in e761e4d
| if (userData.role === 'admin') { |
you can refactor this :
if (userData.role === 'admin') {
token = jwt.sign(userData, process.env.SECRET_COOKIE);
response.writeHead(200, {
'content-type': 'text/plain',
'Set-Cookie': `accessToken=${token}`
});
response.end('/admin');
} else {
token = jwt.sign(userData, process.env.SECRET_COOKIE);
response.writeHead(200, {
'content-type': 'text/plain',
'Set-Cookie': `accessToken=${token}`
});
response.end('/home');
to be like this :
token = jwt.sign(userData, process.env.SECRET_COOKIE);
response.writeHead(200, {
'content-type': 'text/plain',
'Set-Cookie': `accessToken=${token}`
});
if (userData.role === 'admin') {
response.end('/admin');
} else {
response.end('/home');
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels