import { getLatestID } from '@proton/shared/lib/api/events' ; import { Cache } from '@proton/shared/lib/helpers/cache' ; import { Api } from '@proton/shared/lib/interfaces' ; export const getTmpEventID = ( cache ) => { const tmpEventID = cache . get ( 'tmpEventID' ) ; cache . delete ( 'tmpEventID' ) ; return tmpEventID ; } ; export const setTmpEventID = ( cache , eventID ) => { cache . set ( 'tmpEventID' , eventID ) ; } ; const loadEventID = async ( api , cache ) => { return getTmpEventID ( cache ) || api < { EventID : string ; } > ( getLatestID ( ) ) . then ( ( { EventID } ) => EventID ) ; } ; export default loadEventID ;