Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

correct flow logic

Joe29e100d05d5d
diff --git a/examples/vue3-ts-todo-list/src/components/TodoList.vue b/examples/vue3-ts-todo-list/src/components/TodoList.vue
index 6e55841dc30..e421f52060d 100644
--- a/examples/vue3-ts-todo-list/src/components/TodoList.vue
+++ b/examples/vue3-ts-todo-list/src/components/TodoList.vue
@@ -57,14 +57,15 @@ export default defineComponent({
// Try and wrie the data to to the database
const todo = await addTodo({ user_id: userSession.value.user.id, task: task.value })
- // Reset inptut feild
- task.value = ''
-
+ // If there was no response, dont do anything.
if (!todo) {
return
}
// Otherwise push the response into allTodos.
allTodos.value.push(todo)
+
+ // Reset inptut feild
+ task.value = ''
} catch (err) {
console.error('Unknown error when adding todo', err)
}