interface Endpoints { Dashboard : { index : string ; cliLogin : string ; cliSignup : string ; } ; } export function buildEndpoints ( base ) { const endpoint = ( path ) => `${ base }${ path }` ; return { Dashboard : { index : endpoint ( "/dashboard" ) , cliLogin : endpoint ( "/dashboard/cli/login?source=slice-machine" ) , cliSignup : endpoint ( "/dashboard/cli/signup?source=slice-machine" ) , } , } ; } export type Base = `${ "http" | "https" }://${ string }${ "/" | "" }` ; export function extractDomainFromBase ( base ) { const withoutHttp = base . split ( "://" ) [ 1 ] ; const result = withoutHttp . split ( "/" ) [ 0 ] ; return result ; } export function buildRepositoryEndpoint ( base , domain ) { return `https://${ domain }.${ extractDomainFromBase ( base ) }/api/v2` ; }