Add searching
This commit is contained in:
@@ -135,14 +135,6 @@ export const useTaskStore = defineStore('tasks', {
|
||||
}
|
||||
},
|
||||
// TODO: Enhance this store to include offline caching, and subscription notification when items change on the server.
|
||||
|
||||
filterTasksByTitle(searchQuery: string) {
|
||||
const result = this.tasks.filter((task) =>
|
||||
task.title.toLowerCase().includes(searchQuery.toLowerCase())
|
||||
);
|
||||
console.log(result);
|
||||
return result;
|
||||
},
|
||||
},
|
||||
// Add more actions as needed (e.g., updateTask, deleteTask)
|
||||
getters: {
|
||||
@@ -155,5 +147,12 @@ export const useTaskStore = defineStore('tasks', {
|
||||
getSkillById: (state) => (id: string) => {
|
||||
return state.skillTags.find((tag) => tag.$id === id) || null;
|
||||
},
|
||||
filterTasksByTitle: (state) => (searchQuery: string) => {
|
||||
const result = state.tasks.filter((task) =>
|
||||
task.title.toLowerCase().includes(searchQuery.toLowerCase())
|
||||
);
|
||||
console.log(result);
|
||||
return result;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user