api link v1
This commit is contained in:
parent
e6bc1c1b38
commit
9442aac222
@ -3,7 +3,7 @@
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,user-scalable=0"/>
|
||||
<title>Test</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@10/swiper-bundle.min.css" />
|
||||
|
@ -577,8 +577,33 @@ function savePrintButtonListener(e) {
|
||||
}
|
||||
|
||||
|
||||
function sendPrintRequest(action, date, sentence="") {
|
||||
return fetch("/api/todos/print", {
|
||||
method: "post",
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
|
||||
//make sure to serialize your JSON body
|
||||
body: JSON.stringify({
|
||||
date: date,
|
||||
action: action,
|
||||
sentence: sentence
|
||||
})
|
||||
})
|
||||
.then( (response) => {
|
||||
return response.json().then(r => {
|
||||
return r.status
|
||||
})
|
||||
//do something awesome that makes the world a better place
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function printButtonListener(e) {
|
||||
let action = ""
|
||||
let sentence = ""
|
||||
switch(this.id) {
|
||||
case "printGreeting":
|
||||
action = "greeting"
|
||||
@ -597,7 +622,7 @@ function printButtonListener(e) {
|
||||
break;
|
||||
case "printSentence":
|
||||
action = "sentence"
|
||||
let sentence = prompt("What would you like to print?")
|
||||
sentence = prompt("What would you like to print?")
|
||||
break;
|
||||
case "printAll":
|
||||
action = "all"
|
||||
@ -606,6 +631,8 @@ function printButtonListener(e) {
|
||||
document.getElementById("printModel").classList.add("hidden")
|
||||
return
|
||||
}
|
||||
|
||||
console.log(sendPrintRequest(action, dayjs(document.getElementById("date-view").innerHTML.slice(4), "MMM D, YYYY").format("YYYY-MM-DD")), sentence)
|
||||
}
|
||||
|
||||
function switchDayListener(e) {
|
||||
|
@ -1,3 +1,7 @@
|
||||
body {
|
||||
touch-action: manipulation;
|
||||
}
|
||||
|
||||
#radios {
|
||||
position: relative;
|
||||
background-color:rgba(239,239,240,1);
|
||||
|
Loading…
Reference in New Issue
Block a user