Stop form from reloading page

This commit is contained in:
z0ccc 2021-09-29 18:25:32 -04:00
parent e539eb0a75
commit 13f8852622
4 changed files with 7 additions and 4 deletions

View file

@ -26,6 +26,7 @@ form {
cursor: pointer; cursor: pointer;
color: var(--text); color: var(--text);
margin: 0 0 0 6px; margin: 0 0 0 6px;
-webkit-appearance: none;
} }
.saveButton:hover { .saveButton:hover {

View file

@ -39,7 +39,7 @@ const FingerprintBlock = ({ workerData }) => {
if you clear cookies, change your IP or use private mode the hash will if you clear cookies, change your IP or use private mode the hash will
stay the same. Enter a signature and turn on a VPN to test it out. stay the same. Enter a signature and turn on a VPN to test it out.
</p> </p>
<form onSubmit={(e) => postSignature(hash, e.target[0].value)}> <form onSubmit={(e) => postSignature(hash, e, setSignature)}>
<input <input
type="text" type="text"
id="signature" id="signature"

View file

@ -75,7 +75,7 @@ const getConnection = (data) => {
issues: [isProxy], issues: [isProxy],
}, },
{ {
key: 'Organization', key: 'Org',
value: data.org, value: data.org,
issues: [isProxy], issues: [isProxy],
}, },

View file

@ -14,11 +14,13 @@ const getSignature = (hash, setSignature, setload) => {
}); });
}; };
const postSignature = (hash, signature) => { const postSignature = (hash, e, setSignature) => {
e.preventDefault();
axios.post('https://api.vytal.io/fingerprint/', { axios.post('https://api.vytal.io/fingerprint/', {
name: signature, name: e.target[0].value,
hash, hash,
}); });
setSignature(e.target[0].value);
}; };
const getHash = (data) => md5(JSON.stringify(data)).toString(); const getHash = (data) => md5(JSON.stringify(data)).toString();