Refactored userData while working on hompage makeover. (#5916) [deploy]

This commit is contained in:
Nick Taylor 2020-02-06 14:18:52 -05:00 committed by GitHub
parent c9d4dde19c
commit 631867b30f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
}