]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
docs: fix todo example (#413)
authorDanny Feliz <dannyfeliz08@gmail.com>
Wed, 31 Mar 2021 07:41:37 +0000 (03:41 -0400)
committerGitHub <noreply@github.com>
Wed, 31 Mar 2021 07:41:37 +0000 (09:41 +0200)
docs/introduction.md

index 72cb07e19b847c8a2529bd47c2f27d346f0c2d72..d9f5a70fb6f1350cbd4dfdd826ae0cd4c9f99f42 100644 (file)
@@ -67,9 +67,9 @@ export const todos = defineStore({
     filteredTodos() {
       if (this.filter === 'finished') {
         // call other getters with autocompletion ✨
-        return this.finishedTodos()
+        return this.finishedTodos
       } else if (this.filter === 'unfinished') {
-        return this.unfinishedTodos()
+        return this.unfinishedTodos
       }
       return this.todos
     },
@@ -78,7 +78,7 @@ export const todos = defineStore({
     // any amount of arguments, return a promise or not
     addTodo(text) {
       // you can directly mutate the state
-      this.todos.push({ text, id: nextId++, isFinished: false })
+      this.todos.push({ text, id: this.nextId++, isFinished: false })
     },
   },
 })