-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from Muzikie/46-add-faucet-page
Add faucet pages to handlebars
- Loading branch information
Showing
5 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
async function sendTokens (e) { | ||
e.preventDefault(); | ||
const formBody = JSON.stringify(Object.fromEntries(new FormData(this))); | ||
try { | ||
const response = await fetch(this.action, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: formBody, // Send the data as JSON | ||
}); | ||
const data = await response.json(); | ||
document.getElementById('faucet-feedback').textContent = data.success ? 'Sent. Check your wallet!' : 'Something went wrong. Try again later.'; | ||
} catch (error) { | ||
document.getElementById('faucet-feedback').textContent = error.message; | ||
} | ||
}; | ||
|
||
document.addEventListener('DOMContentLoaded', () => { | ||
const form = document.getElementById('faucet-form'); | ||
form.addEventListener('submit', sendTokens); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{{> head title="faucet" }} | ||
<section class="light-mode space_section_last"> | ||
<div class="container is--stage"> | ||
<div class="container__text is--stage"> | ||
<div class="container__16"> | ||
<div class="div-block artist form"> | ||
<div class="container__16 max"> | ||
<h2 class="h2">All tokens are for testing purposes only</h2> | ||
<p class="is--small is--accordion"> | ||
Please enter your address to receive 10 MZK tokens for free | ||
</p> | ||
</div> | ||
<form | ||
action="http://localhost:9902/faucet" | ||
id="faucet-form" | ||
class="form artist pioneer" | ||
> | ||
<div class="scrollpane"> | ||
<div class="container__16 is--form"> | ||
<div class="text-field__container is--vertical"> | ||
<div class="field"> | ||
<div class="text-input custom"> | ||
<div class="html-field w-embed"> | ||
<input class="custom-input" placeholder="Address*" type="text" name="address" id="mce-ADDRESS" maxlength="42" required> | ||
<label class="floating-label" for="mce-ADDRESS">Address*</label> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="text-field__container is--button"> | ||
<button type="submit" class="button is--small is--submit w-button">Submit</button> | ||
</div> | ||
<div class="text-field__container is--button"> | ||
<div class="label" id="faucet-feedback"></div> | ||
</div> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
{{> footer}} | ||
{{> desktopNavigation}} | ||
{{> mobileNavigation}} | ||
{{> backToTop}} | ||
{{> closing}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters