I'm trying to take data from my session but every time I run the tests I get this error
header-core: return JSON.parse(window.sessionStorage.getItem(profileDataHeader));
header-core: ^
header-core: TypeError: Cannot read property 'getItem' of undefined
header-core: at getProfileDataHeader (C:\Users\XXXXX\Documents\YieldPortalHeader\packages\core\src\helpers\utils\/storage.js:9:36)
Code:
const profileData = getProfileDataHeader();
and what the getProfileDataHeader does:
export const getProfileDataHeader = () =>
JSON.parse(window.sessionStorage.getItem(profileDataHeader));
There are other parts from the code which uses the getProfileDataHeader but none of them returns me this error, only when I make the call in this file in specific.
Can anybody help me? I guess the solution might be pretty stupid but I can't get through it!