import { UserSettings } from '../../auth/types' ; import { TeamsSettings } from '../../teams/types' ; import { Workspace } from '../types' ; function get ( key ) { return localStorage . getItem ( key ) ; } function set ( key , value ) { return localStorage . setItem ( key , value ) ; } function getUser ( ) { const stringUser = localStorage . getItem ( 'xUser' ) ; return stringUser ? JSON . parse ( stringUser ) : null ; } function getTeams ( ) { const stringTeam = localStorage . getItem ( 'xTeam' ) ; return stringTeam ? JSON . parse ( stringTeam ) : null ; } function getWorkspace ( ) { return localStorage . getItem ( 'workspace' ) || Workspace . Individuals ; } function removeItem ( key ) { localStorage . removeItem ( key ) ; } function exists ( key ) { return ! ! localStorage . getItem ( key ) ; } function clear ( ) { localStorage . removeItem ( 'xUser' ) ; localStorage . removeItem ( 'xMnemonic' ) ; localStorage . removeItem ( 'xToken' ) ; localStorage . removeItem ( 'xTeam' ) ; localStorage . removeItem ( 'xTokenTeam' ) ; localStorage . removeItem ( 'workspace' ) ; } const localStorageService = { set , get , getUser , getTeams , getWorkspace , removeItem , exists , clear , } ; export default localStorageService ;