localGetter.js 342 Bytes
Newer Older
leiqingsong's avatar
leiqingsong committed
1
export function getUserId() {
leiqingsong's avatar
leiqingsong committed
2 3
  let userInfo = localStorage.getItem("user");
  if (userInfo) {
leiqingsong's avatar
leiqingsong committed
4
    return JSON.parse(userInfo).userId;
leiqingsong's avatar
leiqingsong committed
5 6 7 8
  } else {
    return "";
  }
}
leiqingsong's avatar
leiqingsong committed
9 10 11 12 13 14 15 16 17

export function getUserAvatar() {
  let userInfo = localStorage.getItem("user");
  if (userInfo) {
    return JSON.parse(userInfo).headImage;
  } else {
    return "";
  }
}