export const fetcher = ( url , data = undefined ) => fetch ( window . location . origin + url , { method : data ? "POST" : "GET" , credentials : "include" , headers : { "Content-Type" : "application/json" , } , body : JSON . stringify ( data ) , } ) . then ( ( r ) => r . json ( ) ) ;