fix: initial loading of list
This commit is contained in:
@@ -25,6 +25,7 @@ import { shareLink } from "@/lib/share";
|
|||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
const list = ref<string | null>(null);
|
const list = ref<string | null>(null);
|
||||||
|
const loading = ref<boolean>(true);
|
||||||
const taskInput = ref<string>("");
|
const taskInput = ref<string>("");
|
||||||
const tasks = ref<Task[]>([]);
|
const tasks = ref<Task[]>([]);
|
||||||
|
|
||||||
@@ -54,6 +55,7 @@ function fetchTasks() {
|
|||||||
.then((data: Task[]) => {
|
.then((data: Task[]) => {
|
||||||
tasks.value = data;
|
tasks.value = data;
|
||||||
reSortTasks();
|
reSortTasks();
|
||||||
|
loading.value = false;
|
||||||
setTimeout(fetchTasks, 10000);
|
setTimeout(fetchTasks, 10000);
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
@@ -72,7 +74,7 @@ function reSortTasks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onNewTask() {
|
function onNewTask() {
|
||||||
if (taskInput.value.trim() && list.value) {
|
if (taskInput.value.trim() && list.value && !loading.value) {
|
||||||
createTask(list.value, {
|
createTask(list.value, {
|
||||||
name: taskInput.value.trim(),
|
name: taskInput.value.trim(),
|
||||||
reset_cron: null,
|
reset_cron: null,
|
||||||
@@ -179,7 +181,7 @@ onBeforeRouteUpdate((to) => {
|
|||||||
</li>
|
</li>
|
||||||
</template>
|
</template>
|
||||||
<li
|
<li
|
||||||
v-if="empty"
|
v-if="!loading && empty"
|
||||||
class="list-row italic text-xl font-extralight self-center"
|
class="list-row italic text-xl font-extralight self-center"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
@@ -188,7 +190,7 @@ onBeforeRouteUpdate((to) => {
|
|||||||
></span>
|
></span>
|
||||||
</li>
|
</li>
|
||||||
<li
|
<li
|
||||||
v-else-if="allCompleted && separateCompleted"
|
v-else-if="!loading && allCompleted && separateCompleted"
|
||||||
class="list-row italic text-xl font-extralight self-center"
|
class="list-row italic text-xl font-extralight self-center"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
@@ -209,7 +211,7 @@ onBeforeRouteUpdate((to) => {
|
|||||||
<div>
|
<div>
|
||||||
<button
|
<button
|
||||||
class="btn btn-square"
|
class="btn btn-square"
|
||||||
:disabled="taskInput.trim().length === 0"
|
:disabled="loading || taskInput.trim().length === 0"
|
||||||
@click="onNewTask"
|
@click="onNewTask"
|
||||||
>
|
>
|
||||||
<circle-plus-icon />
|
<circle-plus-icon />
|
||||||
|
|||||||
Reference in New Issue
Block a user