{"action":"created","issue":{"url":"https://api.github.com/repos/flowup/ngx-swagger-client-generator/issues/16","repository_url":"https://api.github.com/repos/flowup/ngx-swagger-client-generator","labels_url":"https://api.github.com/repos/flowup/ngx-swagger-client-generator/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/flowup/ngx-swagger-client-generator/issues/16/comments","events_url":"https://api.github.com/repos/flowup/ngx-swagger-client-generator/issues/16/events","html_url":"https://github.com/flowup/ngx-swagger-client-generator/pull/16","id":293824593,"number":16,"title":"Default to relative path instead of localhost for domain.","user":{"login":"warmans","id":1299401,"avatar_url":"https://avatars1.githubusercontent.com/u/1299401?v=4","gravatar_id":"","url":"https://api.github.com/users/warmans","html_url":"https://github.com/warmans","followers_url":"https://api.github.com/users/warmans/followers","following_url":"https://api.github.com/users/warmans/following{/other_user}","gists_url":"https://api.github.com/users/warmans/gists{/gist_id}","starred_url":"https://api.github.com/users/warmans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/warmans/subscriptions","organizations_url":"https://api.github.com/users/warmans/orgs","repos_url":"https://api.github.com/users/warmans/repos","events_url":"https://api.github.com/users/warmans/events{/privacy}","received_events_url":"https://api.github.com/users/warmans/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-02-02T09:30:00Z","updated_at":"2018-02-02T12:55:45Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/flowup/ngx-swagger-client-generator/pulls/16","html_url":"https://github.com/flowup/ngx-swagger-client-generator/pull/16","diff_url":"https://github.com/flowup/ngx-swagger-client-generator/pull/16.diff","patch_url":"https://github.com/flowup/ngx-swagger-client-generator/pull/16.patch"},"body":"Changes the template to use the window location as the default domain. This seems like a more sensible default. In general it seems to be rather awkward to inject the domain when switching between different API environments (e.g. staging vs prod deployment).\r\n\r\nI've not regenerated the code or anything but I assume I didn't break anything.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/flowup/ngx-swagger-client-generator/issues/comments/362578945","html_url":"https://github.com/flowup/ngx-swagger-client-generator/pull/16#issuecomment-362578945","issue_url":"https://api.github.com/repos/flowup/ngx-swagger-client-generator/issues/16","id":362578945,"user":{"login":"vmasek","id":7274335,"avatar_url":"https://avatars1.githubusercontent.com/u/7274335?v=4","gravatar_id":"","url":"https://api.github.com/users/vmasek","html_url":"https://github.com/vmasek","followers_url":"https://api.github.com/users/vmasek/followers","following_url":"https://api.github.com/users/vmasek/following{/other_user}","gists_url":"https://api.github.com/users/vmasek/gists{/gist_id}","starred_url":"https://api.github.com/users/vmasek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vmasek/subscriptions","organizations_url":"https://api.github.com/users/vmasek/orgs","repos_url":"https://api.github.com/users/vmasek/repos","events_url":"https://api.github.com/users/vmasek/events{/privacy}","received_events_url":"https://api.github.com/users/vmasek/received_events","type":"User","site_admin":false},"created_at":"2018-02-02T12:55:45Z","updated_at":"2018-02-02T12:55:45Z","author_association":"OWNER","body":"\r\n\r\n```typescript\r\nprivate static generateDomain({schemes, host, basePath}: Swagger): string {\r\n    const protocol =\r\n      schemes && schemes.length > 0\r\n        ? schemes[0]\r\n        : 'http';\r\n\r\n    const domain = host ? host : \"${window.location.hostname}${window.location.port ? ':' + window.location.port : ''}\";\r\n    const base = ('/' === basePath ? '' : basePath);\r\n\r\n    return `${protocol}://${domain}${base}`;\r\n  }\r\n```\r\nalso do not forget to add interpolation with no escape in `templates/ngx-service.mustache`\r\n```mustache\r\n  private domain = `{{&domain}}`;\r\n```"}}
{"actor":{"display_login":"vmasek"}}