save and navigate to home where we see tasks

This commit is contained in:
Julien Calixte
2023-04-09 10:21:20 +02:00
parent e6e7db466a
commit 27b1783185
3 changed files with 24 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
<script setup lang="ts">
import { createUuid } from '@/shared/create-uuid'
import { faker } from '@faker-js/faker'
import { computed, ref } from 'vue'
import { useRouter } from 'vue-router'
import { createStepFixture } from '../models/step.fixture'
@@ -12,7 +13,7 @@ const router = useRouter()
const id = createUuid()
const title = ref('')
const title = ref(faker.animal.bird())
const steps = ref([createStepFixture(), createStepFixture()])
const totalEstimation = computed(() =>
steps.value.map((step) => step.estimation).reduce((a, b) => a + b, 0)

View File

@@ -0,0 +1,18 @@
<script setup lang="ts">
import { useTaskStore } from '@/use-cases/task/stores/useTask.store'
const taskStore = useTaskStore()
</script>
<template>
<ul class="task-list">
<li v-for="task in taskStore.tasks" :key="task.id">
{{ task.title }}
</li>
</ul>
</template>
<style scoped>
.task-list {
}
</style>

View File

@@ -1,7 +1,10 @@
<script setup lang="ts"></script>
<script setup lang="ts">
import TaskList from '@/use-cases/task/components/TaskList.vue'
</script>
<template>
<main>
<RouterLink :to="{ name: 'new-task' }">New task</RouterLink>
<task-list />
</main>
</template>