-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Factor out some common stuff from calculator.ts #12
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -62,8 +63,8 @@ export class RewiringAmericaCalculator extends LitElement { | |||
@property({ type: String, attribute: 'api-key' }) | |||
apiKey: string = ''; | |||
|
|||
@property({ type: String, attribute: 'api-path' }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I was using this in working-copy.html for local dev? Fine to evolve away from that, but probably worth resolving now so we don't leave a vestigial usage around.
The aim I had with this api-path property was to allow people embedding the calculator to hide their API key by using a proxy endpoint on their own server instead. Nobody has actually asked for that, and nobody is using it, so I agree we can change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This setup can still support that use case. They'd just have to have their proxy preserve paths instead of hardcoding a destination path. That's easy to do with e.g. nginx.
Will fix working-copy.html.
Also, verified the preview works. Looks good! |
Re fetching multiple paths, the website (non-embed) calculator does this too - it calls |
I want to copy this file for the RI calculator. To avoid too much duplication, this factors out some common logic: the "fetch from API and interpret errors" code, and the static footer. It also changes the `api-path` attribute of the calculator element to `api-host`, which should contain only the protocol and hostname, not the path. Since the RI calculator will be fetching multiple paths, I want to separate path from host. `api-path` is not publicly documented, so I think it's fine to remove it.
5667541
to
19b82a2
Compare
I want to copy this file for the RI calculator. To avoid too much duplication, this factors out some common logic: the "fetch from API and interpret errors" code, and the static footer.
It also changes the
api-path
attribute of the calculator element toapi-host
, which should contain only the protocol and hostname, not the path. Since the RI calculator will be fetching multiple paths, I want to separate path from host.api-path
is not publicly documented, so I think it's fine to remove it.