Skip to content

Commit

Permalink
Add editing task
Browse files Browse the repository at this point in the history
  • Loading branch information
vanarok committed Oct 23, 2024
1 parent 996f5b0 commit 348087a
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions components/Task.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@
:class="[{'task-text-overlay-effect': visibleOverlay}]"
:value="task.description"
class="task-text"
disabled
style="background: none; font-family: Inter; font-size: 1.2em; padding: 0; width: 100%; height: 100%; border: none"
style="
background: none;
font-family: Inter;
font-size: 1.2em;
width: 100%;
height: 100%;
border: none;
outline-color: #747bff55;
"
type="text"
@input="updateDescription($event.target.value)"
/>
<Transition>
<div v-if="hover" class="info">
Expand Down Expand Up @@ -206,6 +214,23 @@ const getTime = () => {
)
return new Date(time * 1000).toISOString().slice(11, 19)
}
const updateDescription = (description: string) => {
editDescription({description})
}
const {mutate: editDescription} = useMutation({
mutationFn: ({description}: {description: string}) =>
putTask(props.task.id, {
data: {
...props.task,
description
}
}),
onError(_, __, context) {
queryClient.setQueryData(['tasks', props.project?.id ?? null], context.previousTodos)
}
})
</script>

<style scoped>
Expand Down

0 comments on commit 348087a

Please sign in to comment.