I'm doing some customizations to Vuexy admin panel.
I'm trying to get theme configuration information from the backend, but I'm doing something wrong. When the client is logging in, I'm using setItem
, like so:
localStorage.setItem('themeConfig', JSON.stringify(response.data.theme_config))
I have tested that and response.data.theme_config is returning json from backend, like so:
"theme_config": {
"id": 1,
"user_id": 1,
"disableCustomizer": 1,
"disableThemeTour": 1,
"footerType": "static",
"hideScrollToTop": 0,
"mainLayoutType": "vertical",
"navbarColor": "#fff",
"navbarType": "static",
"routerTransition": "fade-bottom",
"rtl": 0,
"sidebarCollapsed": 0,
"theme": "dark",
"created_at": null,
"updated_at": null
}
Now, what I'm trying to do is to call getItem
like so:
const themeConfig = JSON.parse(localStorage.getItem("themeConfig"))
But every time this is returning [object Object]
I tried without success both:
JSON.parse(JSON.stringify(localStorage.getItem("themeConfig")))
JSON.stringify(localStorage.getItem("themeConfig"))
And when I try console.log('asdasdadeasd' + JSON.stringify(response.data.theme_config))
I receive this:
{
"id": 1,
"user_id": 1,
"disableCustomizer": 1,
"disableThemeTour": 1,
"footerType": "static",
"hideScrollToTop": 0,
"mainLayoutType": "vertical",
"navbarColor": "#fff",
"navbarType": "static",
"routerTransition": "fade-bottom",
"rtl": 0,
"sidebarCollapsed": 0,
"theme": "dark",
"created_at": null,
"updated_at": null
}