Skip to content

Commit

Permalink
test running cloud endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
antoninpire committed Sep 30, 2023
1 parent 453d3e9 commit 5ec309a
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,37 @@
<script lang="ts">
let loading = false;
let url = '';
let response = '';
let method: 'GET' | 'POST' = 'GET';
async function handleClick() {
loading = true;
await fetch('http://localhost:5173/api/seed', {
method: 'POST'
const res = await fetch(url, {
method: 'POST',
body: JSON.stringify({
email: '[email protected]',
password: 'demo'
}),
headers: {
'Content-type': 'application/json'
}
});
const json = await res.json();
response = JSON.stringify(json, null, 2);
loading = false;
}
</script>

<button disabled={loading} on:click={handleClick}>{!loading ? 'Seed' : 'Seeding...'}</button>
<input type="text" bind:value={url} class="bg-black border-white border min-w-[450px]" />
<select bind:value={method} class="text-white bg-black">
<option value="GET">GET</option>
<option value="POST">POST</option>
</select>
<button disabled={loading} on:click={handleClick}>{!loading ? 'Send' : 'Sending...'}</button>
<br />
<pre>{response}</pre>

<!-- local to local WORKS -->
<!-- cloud to local WORKS -->
<!-- local to cloud WORKS -->
<!-- cloud to cloud ??? -->

0 comments on commit 5ec309a

Please sign in to comment.