mirror of
https://github.com/justinian/postmortem.git
synced 2025-12-09 16:14:31 -08:00
Initial commit
This commit is contained in:
26
static/main.js
Normal file
26
static/main.js
Normal 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");
|
||||
});
|
||||
}
|
||||
BIN
static/route.png
Executable file
BIN
static/route.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 MiB |
Reference in New Issue
Block a user