79241665

Date: 2024-12-01 13:34:58
Score: 4
Natty:
Report link

To avoid this error without turning off SSR, I use a code like this,

ngOnInit(): void {
if (typeof window !== 'undefined' && localStorage) {
  this.adminId = localStorage.getItem('admin_id') || '';
  this.loadAdminDetails(this.adminId);
}}

And I would also like to know whether this method has any issue. Thanks in advance.

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • RegEx Blacklisted phrase (3): Thanks in advance
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Buddhi Gayan