Add searching

This commit is contained in:
2024-04-08 11:28:45 -04:00
parent 6ab1aa26b1
commit ffaf31bbeb
3 changed files with 26 additions and 11 deletions

View File

@@ -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;
},
},
});