mirror of
				https://github.com/cinnyapp/cinny.git
				synced 2025-11-04 14:30:29 +03:00 
			
		
		
		
	Change update local store to instead store in the matrixSessions array for multiple sessions
This commit is contained in:
		
							parent
							
								
									0ce857f499
								
							
						
					
					
						commit
						b1793832a3
					
				
					 1 changed files with 11 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -1,4 +1,5 @@
 | 
			
		|||
import cons from '../state/cons';
 | 
			
		||||
import { setLocalStorageItem } from '../../app/state/utils/atomWithLocalStorage';
 | 
			
		||||
import { Session } from '../../app/state/sessions';
 | 
			
		||||
 | 
			
		||||
export function updateLocalStore(
 | 
			
		||||
  accessToken: string,
 | 
			
		||||
| 
						 | 
				
			
			@ -6,8 +7,13 @@ export function updateLocalStore(
 | 
			
		|||
  userId: string,
 | 
			
		||||
  baseUrl: string
 | 
			
		||||
) {
 | 
			
		||||
  localStorage.setItem(cons.secretKey.ACCESS_TOKEN, accessToken);
 | 
			
		||||
  localStorage.setItem(cons.secretKey.DEVICE_ID, deviceId);
 | 
			
		||||
  localStorage.setItem(cons.secretKey.USER_ID, userId);
 | 
			
		||||
  localStorage.setItem(cons.secretKey.BASE_URL, baseUrl);
 | 
			
		||||
  const newSession: Session = {
 | 
			
		||||
    accessToken,
 | 
			
		||||
    deviceId,
 | 
			
		||||
    userId,
 | 
			
		||||
    baseUrl,
 | 
			
		||||
    fallbackSdkStores: false,
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  setLocalStorageItem('matrixSessions', [newSession]);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue