add link to User Story

This commit is contained in:
Julien Calixte
2023-04-09 22:55:55 +02:00
parent cd49c4cf0a
commit 7e8cdd4b78
2 changed files with 25 additions and 3 deletions

View File

@@ -14,19 +14,30 @@ const router = useRouter()
const id = createUuid()
const title = ref(faker.animal.bird())
const steps = ref([createStepFixture(), createStepFixture()])
const link = ref(faker.internet.url())
const steps = ref(
Array.from({ length: Math.floor(Math.random() * 10) }, () =>
createStepFixture()
)
)
const totalEstimation = computed(() =>
steps.value.map((step) => step.estimation).reduce((a, b) => a + b, 0)
)
const saveTask = () => {
const task = new Task(id, title.value)
if (link.value) {
task.link = link.value
}
task.addSteps(...steps.value)
if (Task.validate(task)) {
store.saveTask(task)
router.push({
name: 'home'
name: 'task-view',
params: {
id
}
})
}
@@ -44,6 +55,10 @@ const saveTask = () => {
<label for="title">Title</label>
<input type="text" id="title" v-model="title" />
</div>
<div>
<label for="link">User story link</label>
<input type="text" id="link" v-model="link" />
</div>
<StepInput v-model="steps" />
</form>
</div>