I have a value that is being stored in sessionStorage. I am trying to get this data and store it in a service file where it can then be used in other parts of my app. I do not want to keep on calling the values directly from my sessionStorage as it will not be used in the future.

Here is my code


sessionStorage.setItem("value", "{"token_type":"Bearer","scope":"openid","profile":{"name":"grumpy","email":"[email protected]","email_verified":true,"phone_number":"0912829343","phone_number_verified":false,"role":"HR Admin"}}");


setStoreData() {
 return JSON.parse(sessionStorage.getItem(value));

When I try to call the service file function I get this in the console

store: function () {
        return JSON.parse(value + ":" + src_environments_environment__WEBPACK_IMPORTED_MODULE_0__["environment"].clientId));

I don't seem to be returning the values correctly. Any ideas why?

0 Answers