Skip to content

Commit 5bcc5ac

Browse files
author
Hans Kristian Flaatten
committed
fix(auth): TypeError: Cannot read property 'split' of null
Sentry: https://sentry.app.dnt.no/dnt/developer/group/1219/
1 parent bc572f2 commit 5bcc5ac

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

apps/profile/controller.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ app.use('/', (req, res, next) => {
1717
ApiUser.findOne(query, (err, api) => {
1818
if (err) { return next(err); }
1919

20+
const name = req.session.auth.fullName || req.session.auth.userName;
21+
const email = req.session.auth.email;
22+
2023
req.api = api || new ApiUser({
21-
provider: req.session.auth.fullName.split(' ').reverse()[0].toUpperCase(),
22-
contact: {
23-
name: req.session.auth.fullName,
24-
email: req.session.auth.email,
25-
},
24+
provider: name.split(' ').reverse()[0].toUpperCase(),
25+
contact: { name, email },
2626
});
2727

2828
return next();

0 commit comments

Comments
 (0)