warn the user that records are reset when editing task

This commit is contained in:
Julien Calixte
2023-05-20 12:51:47 +02:00
parent f5334e5e6d
commit 037e7ed055

View File

@@ -2,16 +2,30 @@
import TaskForm from '@/modules/task/components/TaskForm.vue' import TaskForm from '@/modules/task/components/TaskForm.vue'
import TaskNotFound from '@/modules/task/components/TaskNotFound.vue' import TaskNotFound from '@/modules/task/components/TaskNotFound.vue'
import { useTaskStore } from '@/modules/task/stores/useTask.store' import { useTaskStore } from '@/modules/task/stores/useTask.store'
import { ref } from 'vue'
const props = defineProps<{ id: string }>() const props = defineProps<{ id: string }>()
const store = useTaskStore() const taskStore = useTaskStore()
const task = store.getTask(props.id) const isMessageDisplayed = ref(true)
const task = taskStore.getTask(props.id)
</script> </script>
<template> <template>
<div class="edit-task"> <div class="edit-task">
<TaskForm v-if="task" :id="task.id" :initial-task="task" /> <TaskForm v-if="task" :id="task.id" :initial-task="task" />
<task-not-found v-else /> <task-not-found v-else />
<article v-if="isMessageDisplayed" class="message is-info">
<div class="message-header">
<p>Info</p>
<button
class="delete"
aria-label="delete"
@click="isMessageDisplayed = false"
></button>
</div>
<div class="message-body">When editing a task, record will be reset.</div>
</article>
</div> </div>
</template> </template>