mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] examples: update store example
This commit is contained in:
@@ -35,16 +35,16 @@ const actions = {
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
const mutations = {
|
const mutations = {
|
||||||
addTodo(state, title) {
|
addTodo({ state }, title) {
|
||||||
const id = state.nextId++;
|
const id = state.nextId++;
|
||||||
const todo = { id, title, completed: false };
|
const todo = { id, title, completed: false };
|
||||||
state.todos.push(todo);
|
state.todos.push(todo);
|
||||||
},
|
},
|
||||||
removeTodo(state, id) {
|
removeTodo({ state }, id) {
|
||||||
const index = state.todos.findIndex(t => t.id === id);
|
const index = state.todos.findIndex(t => t.id === id);
|
||||||
state.todos.splice(index, 1);
|
state.todos.splice(index, 1);
|
||||||
},
|
},
|
||||||
editTodo(state, { id, title, completed }) {
|
editTodo({ state }, { id, title, completed }) {
|
||||||
const todo = state.todos.find(t => t.id === id);
|
const todo = state.todos.find(t => t.id === id);
|
||||||
if (title !== undefined) {
|
if (title !== undefined) {
|
||||||
todo.title = title;
|
todo.title = title;
|
||||||
|
|||||||
Reference in New Issue
Block a user