This is the code that runs https://bandolier.learnjsthehardway.com/ for you to review. It uses the https://git.learnjsthehardway.com/learn-javascript-the-hard-way/bandolier-template to create the documentation for the project.
https://bandolier.learnjsthehardway.com/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
794 B
29 lines
794 B
<script>
|
|
import { createEventDispatcher } from 'svelte';
|
|
import api from "$/client/api.js";
|
|
|
|
const dispatch = createEventDispatcher();
|
|
|
|
const dispatch_finished = async (ev) => {
|
|
const [status, data] = await api.post("/api/payments/fake");
|
|
if(status == 200) {
|
|
dispatch("finished", ev);
|
|
} else {
|
|
console.log("Failed to post to fake", data);
|
|
dispatch("error", ev);
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<button data-testid="fake-payment-button" type="button" on:click={ (ev) => dispatch_finished(ev) }>
|
|
Fake Payment
|
|
</button>
|
|
|
|
<button data-testid="fake-payment-cancel" type="button" on:click={ (ev) => dispatch("canceled", ev) }>
|
|
Cancel
|
|
</button>
|
|
|
|
|
|
<button data-testid="fake-payment-error" type="button" on:click={ (ev) => dispatch("error", ev) }>
|
|
Cause Error
|
|
</button>
|
|
|