refactor: Update getUserData function to return empty user data object instead of throwing an error when localStorage is missing values
This commit is contained in:
parent
0892d0dd53
commit
6c8eb7d2f3
|
@ -11,7 +11,12 @@ export const getUserData = (): UserData => {
|
|||
const userName = localStorage.getItem("userName");
|
||||
|
||||
if (!email || !userId) {
|
||||
throw new Error("User data not found in localStorage");
|
||||
return {
|
||||
email: '',
|
||||
userId: '',
|
||||
userName: '',
|
||||
organization: '',
|
||||
};
|
||||
}
|
||||
|
||||
const [_, emailDomain] = email.split("@");
|
||||
|
|
Loading…
Reference in New Issue