import { CookieHandler , UniversalCookies } from '../interfaces' ; import * as JsCookies from 'js-cookie' ; export class BrowserHandler implements CookieHandler { private cookies : typeof JsCookies ; constructor ( cookies = JsCookies ) { this . cookies = cookies ; } get ( key ) { return this . cookies . get ( key ) ; } set ( key , value , options ) { const filled = { ... UniversalCookies . Options . DEFAULT , ... options } ; this . cookies . set ( key , value , ( { expires : filled . expires , path : filled . path , domain : filled . domain , secure : filled . secure , } as JsCookies . CookieAttributes ) ) ; } remove ( key , options ) { const filled = { ... UniversalCookies . Options . DEFAULT , ... options } ; this . cookies . remove ( key , ( { expires : filled . expires , path : filled . path , domain : filled . domain , secure : filled . secure , } as JsCookies . CookieAttributes ) ) ; } }