day selectors work
This commit is contained in:
parent
febb3cd3d8
commit
6e2ed5bd0b
@ -669,7 +669,7 @@ function loginAction(e) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
function getTodosFromAPI() {
|
function getTodosFromAPI(day=dayjs().format("YYYY-MM-DD")) {
|
||||||
document.getElementById("loginPanel").classList.add("hidden")
|
document.getElementById("loginPanel").classList.add("hidden")
|
||||||
console.log(jToken)
|
console.log(jToken)
|
||||||
// console.log(t)
|
// console.log(t)
|
||||||
@ -678,7 +678,7 @@ function getTodosFromAPI() {
|
|||||||
// document.getElementById("testToken").innerHTML = t
|
// document.getElementById("testToken").innerHTML = t
|
||||||
|
|
||||||
fetch('/api/todos/get?' + new URLSearchParams({
|
fetch('/api/todos/get?' + new URLSearchParams({
|
||||||
date: dayjs().format("YYYY-MM-DD"),
|
date: day,
|
||||||
}), {
|
}), {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
@ -775,9 +775,14 @@ function switchDayListener(e) {
|
|||||||
switch (this.id) {
|
switch (this.id) {
|
||||||
case "nextDayButton":
|
case "nextDayButton":
|
||||||
dateView.innerHTML = dayjs(dateView.innerHTML.slice(4), "MMM D, YYYY").add(1, 'day').format("ddd MMM D, YYYY")
|
dateView.innerHTML = dayjs(dateView.innerHTML.slice(4), "MMM D, YYYY").add(1, 'day').format("ddd MMM D, YYYY")
|
||||||
|
document.querySelectorAll('.task-row').forEach(e => e.remove());
|
||||||
|
getTodosFromAPI(dayjs(dateView.innerHTML.slice(4), "MMM D, YYYY").format("YYYY-MM-DD"))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "prevDayButton":
|
case "prevDayButton":
|
||||||
dateView.innerHTML = dayjs(dateView.innerHTML.slice(4), "MMM D, YYYY").subtract(1, 'day').format("ddd MMM D, YYYY")
|
dateView.innerHTML = dayjs(dateView.innerHTML.slice(4), "MMM D, YYYY").subtract(1, 'day').format("ddd MMM D, YYYY")
|
||||||
|
document.querySelectorAll('.task-row').forEach(e => e.remove());
|
||||||
|
getTodosFromAPI(dayjs(dateView.innerHTML.slice(4), "MMM D, YYYY").format("YYYY-MM-DD"))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user