mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-04 04:57:51 +00:00 
			
		
		
		
	This PR will prevent saving user preferences and online status when impersonating. Previously, these settings could be updated during impersonation, causing the user to see a different view or UI settings. Fixes https://linear.app/chatwoot/issue/CW-4163/impersonation-improvements
		
			
				
	
	
		
			27 lines
		
	
	
		
			545 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			545 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
export default {
 | 
						|
  clearAll() {
 | 
						|
    window.sessionStorage.clear();
 | 
						|
  },
 | 
						|
 | 
						|
  get(key) {
 | 
						|
    try {
 | 
						|
      const value = window.sessionStorage.getItem(key);
 | 
						|
      return value ? JSON.parse(value) : null;
 | 
						|
    } catch (error) {
 | 
						|
      return window.sessionStorage.getItem(key);
 | 
						|
    }
 | 
						|
  },
 | 
						|
 | 
						|
  set(key, value) {
 | 
						|
    if (typeof value === 'object') {
 | 
						|
      window.sessionStorage.setItem(key, JSON.stringify(value));
 | 
						|
    } else {
 | 
						|
      window.sessionStorage.setItem(key, value);
 | 
						|
    }
 | 
						|
  },
 | 
						|
 | 
						|
  remove(key) {
 | 
						|
    window.sessionStorage.removeItem(key);
 | 
						|
  },
 | 
						|
};
 |