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.9 KiB

import styles from '../styles/components/Footer.module.css'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faHeart } from '@fortawesome/free-solid-svg-icons'
export default function Footer() {
return (
<div>
<div className={styles.footer}>
<div className="container">
<p>
<b>
Made with <FontAwesomeIcon icon={faHeart} style={{color: "#63C5DA"}} size="1x" id="clickMeow" onClick={() => updateMeowCount()} /> by <a href="https://dubbelnull.com" className="link" target="_blank">DubbelNull</a>
</b>
<br/>
NextJS // Vercel // Airtable
</p>
</div>
</div>
<script src="js/meow.js"></script>
</div>
)
}
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)
});
}