HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //proc/self/root/home/arjun/projects/buyercall/buyercall/assets/vue/widgets/CommWidget/utils.js
export const getChatSessionId = () => {
  // Check if local storage have chat sessionid
  if (!localStorage.getItem('bc_chat_session_id')) {
    return null;
  }
  //check if local storage have chat session timestamp
  if (!localStorage.getItem('bc_chat_session_timeout')) {
    return null;
  }

  //check if the timestamp is a valid timestamp
  if (!new Date(timestamp).getTime() > 0) {
    return null;
  }
  // check if chat session have not expired
  if (new Date(timestamp).getTime() - new Date().getTime() < 0) {
    localStorage.removeItem('bc_chat_session_id');
    localStorage.removeItem('bc_chat_session_timeout');
    return null;
  }
  return localStorage.getItem('bc_chat_session_id');
};