Skip to content
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

localstripe.js: Fix LOCALSTRIPE_BASE_API on dynamical load #225

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

adrienverge
Copy link
Owner

This continues commit c89bb15 "API: Allow serving localstripe API from a custom URL" by simplifying the way to get localstripe server URL, and also fixes the case when localstripe.js is loaded dynamically (in this case, document.getElementsByTagName('script') references the wrong element: the calling/parent <script>) like this:

let script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'http://localhost:8420/js.stripe.com/v3/';
document.head.appendChild(script);

This continues commit c89bb15 "API: Allow serving localstripe API from a
custom URL" by simplifying the way to get localstripe server URL, and
also fixes the case when `localstripe.js` is loaded dynamically (in this
case, `document.getElementsByTagName('script')` references the wrong
element: the calling/parent `<script>`) like this:

    let script = document.createElement('script');
    script.type = 'text/javascript';
    script.src = 'http://localhost:8420/js.stripe.com/v3/';
    document.head.appendChild(script);
Copy link
Collaborator

@feliixx feliixx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

Copy link

@GuillaumeCz GuillaumeCz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Collaborator

@H--o-l H--o-l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@adrienverge
Copy link
Owner Author

Thanks!

@adrienverge adrienverge merged commit 8f8afa6 into master Sep 17, 2024
12 checks passed
@adrienverge adrienverge deleted the fix/better-script-source branch September 17, 2024 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants