mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-05 10:13:00 +02:00
Co-authored-by: Lucas Nogueira <lucas@tauri.studio> Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com> Co-authored-by: Ngo Iok Ui (Wu Yu Wei) <wusyong9104@gmail.com> Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: david <david@lemarier.ca> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: chip <chip@chip.sh>
32 lines
573 B
Svelte
32 lines
573 B
Svelte
<script>
|
|
let foo = 'baz'
|
|
let bar = 'qux'
|
|
let result = null
|
|
|
|
async function doPost () {
|
|
let url = navigator.userAgent.includes("Windows") ? "https://customprotocol.test/example.html" : "customprotocol://test/example.html";
|
|
const res = await fetch(url, {
|
|
method: 'POST',
|
|
body: JSON.stringify({
|
|
foo,
|
|
bar
|
|
})
|
|
})
|
|
|
|
const json = await res.json()
|
|
result = JSON.stringify(json)
|
|
}
|
|
</script>
|
|
|
|
|
|
<input bind:value={foo} />
|
|
<input bind:value={bar} />
|
|
<button type="button" on:click={doPost}>
|
|
Post it.
|
|
</button>
|
|
<p>
|
|
Result:
|
|
</p>
|
|
<pre>
|
|
{result}
|
|
</pre> |