Skip to content

Commit

Permalink
Merge pull request #439 from ariesjia/1
Browse files Browse the repository at this point in the history
refactor(dashboard): add try for JSON.parse to prevent breaking
  • Loading branch information
vplasencia authored Mar 13, 2024
2 parents 275d4a1 + 118c4fb commit ffd4a77
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/dashboard/src/utils/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ export function getAdmin() {
const admin = localStorage.getItem("admin")

if (admin) {
return JSON.parse(admin)
try {
return JSON.parse(admin)
} catch (error) {
console.error("Failed to parse admin data:", error)
}
}

return null
Expand Down

0 comments on commit ffd4a77

Please sign in to comment.