debounce the contact form button
This commit is contained in:
parent
b09f894ffe
commit
d14b9dc7a0
@ -4,10 +4,12 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
let title = '', name = '', message = '';
|
let title = '', name = '', message = '';
|
||||||
|
let loading = false;
|
||||||
|
|
||||||
async function sendSuggestion()
|
async function sendSuggestion()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
loading = true;
|
||||||
const res = await fetch(`/suggestions`, {
|
const res = await fetch(`/suggestions`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@ -25,6 +27,8 @@
|
|||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
} finally {
|
||||||
|
loading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -88,7 +92,7 @@
|
|||||||
<p>Name: <input type="text" name="name" bind:value={name} placeholder="Anonymous"></p>
|
<p>Name: <input type="text" name="name" bind:value={name} placeholder="Anonymous"></p>
|
||||||
<p>Title: <input type="text" name="title" bind:value={title}></p>
|
<p>Title: <input type="text" name="title" bind:value={title}></p>
|
||||||
<p><textarea name="message" bind:value={message}></textarea></p>
|
<p><textarea name="message" bind:value={message}></textarea></p>
|
||||||
<p><button type="submit">Send</button></p>
|
<p><button type="submit" disabled={loading}>Send</button></p>
|
||||||
</form>
|
</form>
|
||||||
<!-- ad goes here -->
|
<!-- ad goes here -->
|
||||||
<h1 class="center">Come Find Us!</h1>
|
<h1 class="center">Come Find Us!</h1>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user