export const setCookie = ( key , value , day ) => { const date = new Date ( ) ; date . setDate ( date . getDate ( ) + day ) ; document . cookie = `${ key }=${ value }; path=/; expires=${ date . toUTCString ( ) };` ; } ; export const getCookie = ( key ) => { const cookies = document . cookie . split ( ";" ) ; for ( const cookie of cookies ) { const value = cookie . split ( "=" ) ; if ( value [ 0 ] === key ) return value [ 1 ] ; } } ;