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
const [email, setEmail] = useState("") | |
const handleSubmit = e => { | |
fetch("/", { | |
method: "POST", | |
headers: { "Content-Type": "application/x-www-form-urlencoded" }, | |
body: formEncode({ "form-name": "register", email: email }), | |
}) | |
.then(() => alert("Success!")) | |
.catch(error => alert(error)) |
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
<form | |
name="register" | |
data-netlify="true" | |
data-netlify-honeypot="sneaky-sneaky" | |
onSubmit={handleSubmit} | |
> | |
<input | |
type="text" | |
name="email" | |
placeholder="Enter your email" |
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
const filterCards = (boards, filter) => | |
boards.reduce((result, board) => { | |
const cardsResult = board.lists.reduce((cards, list) => { | |
if ( | |
board.closed === false && | |
list.closed === false && | |
(filter.length === 0 || | |
list.name.toLowerCase() === filter.toLowerCase()) | |
) { | |
return cards.concat(list.cards.filter(card => card.closed === false)); |
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
let boards = await trelloData.getBoards(); | |
boards = await Promise.all( | |
boards.map(async board => { | |
const lists = await trelloData.getLists(board.id, true); | |
board.lists = lists; | |
return board; | |
}) | |
); |
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
getBoards() { | |
return new Promise((resolve, reject) => { | |
Trello.get( | |
"/members/me/boards/", | |
boards => resolve(boards), | |
error => reject(new Error(`Getting boards failed: ${error}`)) | |
); | |
}); | |
} |
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
<script src="https://api.trello.com/1/client.js?key=MY_KEY"></script> | |
<script type="text/javascript"> | |
Trello.authorize({ | |
name: "My site", | |
scope: { | |
read: true, | |
write: false | |
}, | |
expiration: "never", |
NewerOlder