Refactored userData while working on hompage makeover. (#5916) [deploy]
This commit is contained in:
parent
c9d4dde19c
commit
631867b30f
1 changed files with 2 additions and 7 deletions
|
|
@ -1,12 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
function userData() {
|
||||
const dataUser = document
|
||||
.getElementsByTagName('body')[0]
|
||||
.getAttribute('data-user');
|
||||
const { user = null } = document.body.dataset;
|
||||
|
||||
if (dataUser === null) {
|
||||
return null;
|
||||
}
|
||||
return JSON.parse(dataUser);
|
||||
return JSON.parse(user);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue