You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.8 KiB

import styles from '../styles/components/Footer.module.css'
3 years ago
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faHeart } from '@fortawesome/free-solid-svg-icons'
3 years ago
export default function Footer() {
return (
<div>
<div className={styles.footer}>
<div className="container">
<p>
<b>
3 years ago
Made with <FontAwesomeIcon icon={faHeart} style={{color: "#63C5DA"}} size="1x" id="clickMeow" onClick={() => updateMeowCount()} /> by <a href="https://twitter.com/midblep" className="link" target="_blank">Midblep</a>
3 years ago
</b>
<br/>
NextJS // Vercel // Airtable
</p>
</div>
</div>
3 years ago
<script src="js/meow.js"></script>
</div>
3 years ago
)
3 years ago
}
async function updateMeowCount() {
const getMeow = await fetch("https://api.airtable.com/v0/appQnOyKBnBVQXLUM/Meows", {
method: "GET",
headers: {
'Content-Type': 'application/json',
"Authorization": "Bearer " + process.env.AIRTABLE,
}
});
let meowCount = await getMeow.json();
meowCount = parseInt(meowCount['records'][0]['fields']['count']);
meowCount++;
const updateMeow = {
"records": [
{
"id": "recR9RbScmJUPGQem",
"fields": {
"count": meowCount + ""
}
}
]
};
await fetch("https://api.airtable.com/v0/appQnOyKBnBVQXLUM/Meows", {
method: "PATCH",
headers: {
'Content-Type': 'application/json',
"Authorization": "Bearer " + process.env.AIRTABLE,
"accept": "application/json",
},
body: JSON.stringify(updateMeow)
});
3 years ago
}