import { uuid } from "@repo/utils";

/**
 * 获取token
 */
export const getToken = () => {
  const enterpriseCode = sessionStorage.getItem("enterpriseCode");
  const token = localStorage.getItem("token_" + enterpriseCode);

  return token;
};

/**
 * 创建一个简单的hash值
 * @param str 
 * @returns 
 */
export function simpleHash(str: string) {
  let hash = 0;

  for (let i = 0; i < str.length; i++) {
    const char = str.charCodeAt(i);

    hash = (hash << 5) - hash + char;

    hash |= 0; // Convert to 32bit integer
  }

  return hash.toString();
}
