refacto task not found
This commit is contained in:
20
src/modules/task/components/TaskNotFound.vue
Normal file
20
src/modules/task/components/TaskNotFound.vue
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<template>
|
||||||
|
<div class="no-task-found">
|
||||||
|
<p>Task not found.</p>
|
||||||
|
<router-link :to="{ name: 'home' }" class="button">
|
||||||
|
<img src="/icons/left.svg" alt="left arrow" />
|
||||||
|
go to homepage</router-link
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.no-task-found {
|
||||||
|
margin: auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
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 { useTaskStore } from '@/modules/task/stores/useTask.store'
|
import { useTaskStore } from '@/modules/task/stores/useTask.store'
|
||||||
|
|
||||||
const props = defineProps<{ id: string }>()
|
const props = defineProps<{ id: string }>()
|
||||||
@@ -11,25 +12,6 @@ const task = store.getTask(props.id)
|
|||||||
<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" />
|
||||||
<div v-else class="no-task-found">
|
<task-not-found v-else />
|
||||||
<p>Task not found.</p>
|
|
||||||
<router-link :to="{ name: 'home' }" class="button">
|
|
||||||
<img src="/icons/left.svg" alt="left arrow" />
|
|
||||||
go to homepage</router-link
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
.edit-task {
|
|
||||||
.no-task-found {
|
|
||||||
margin: auto;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
gap: 1rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import EstimationTimeArrival from '@/components/EstimationTimeArrival.vue'
|
import EstimationTimeArrival from '@/components/EstimationTimeArrival.vue'
|
||||||
import TaskRecordPreview from '@/modules/record/components/TaskRecordPreview.vue'
|
import TaskRecordPreview from '@/modules/record/components/TaskRecordPreview.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 { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
@@ -66,7 +67,7 @@ const deleteTask = () => {
|
|||||||
</div>
|
</div>
|
||||||
<task-record-preview :task-id="id" />
|
<task-record-preview :task-id="id" />
|
||||||
</div>
|
</div>
|
||||||
<div v-else>Task not found</div>
|
<task-not-found v-else />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
Reference in New Issue
Block a user