Initial commit

This commit is contained in:
Justin C. Miller
2023-01-28 15:04:42 -08:00
commit 7565ead8c9
7 changed files with 230 additions and 0 deletions

26
static/main.js Normal file
View File

@@ -0,0 +1,26 @@
function update(key, word) {
let url = "/poem/" + key;
return fetch(url, {
"method": "POST",
"body": word,
})
.then( resp => resp.text() )
.then( text => {
console.log("new key", text);
return text;
});
}
export function update_all(starting_key, words) {
var promise = Promise.resolve(starting_key);
for (const word of words) {
if (word.length < 1) continue;
promise = promise.then( key => {
return update(key, word);
});
}
return promise.then( key => {
return update(key, "\n");
});
}