import { CoreSessionState } from '../models/core-session-state.model' ; export function sessionData ( ) { const coreState = JSON . parse ( sessionStorage . getItem ( 'coreState' ) ) ; return coreState ? coreState : new CoreSessionState ( ) ; } export function updateSession ( data ) { const sessionState = sessionData ( ) ; const updatedSessionState = JSON . stringify ( { ... sessionState , ... data } ) ; sessionStorage . setItem ( 'coreState' , updatedSessionState ) ; }