Basic Task Display
This commit is contained in:
@@ -11,9 +11,20 @@ export interface Task extends Models.Document {
|
||||
completed: boolean;
|
||||
}
|
||||
|
||||
export interface TaskTag extends Models.Document {
|
||||
name: string;
|
||||
description: string;
|
||||
}
|
||||
export interface SkillTag extends Models.Document {
|
||||
name: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export const useTaskStore = defineStore('tasks', {
|
||||
state: () => ({
|
||||
tasks: [] as Task[],
|
||||
taskTags: [] as TaskTag[],
|
||||
skillTags: [] as SkillTag[],
|
||||
}),
|
||||
|
||||
actions: {
|
||||
@@ -28,6 +39,30 @@ export const useTaskStore = defineStore('tasks', {
|
||||
console.error('Failed to fetch tasks', error);
|
||||
}
|
||||
},
|
||||
async fetchTaskTags() {
|
||||
// This is fine for a small number of tags, but more than a few hundred tags, we'd need to optimize
|
||||
try {
|
||||
const response = await databases.listDocuments(
|
||||
AppwriteIds.databaseId,
|
||||
AppwriteIds.collectionIdTaskTags
|
||||
);
|
||||
this.taskTags = response.documents as TaskTag[];
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch tasks', error);
|
||||
}
|
||||
},
|
||||
async fetchSkillTags() {
|
||||
// This is fine for a small number of tags, but more than a few hundred tags, we'd need to optimize
|
||||
try {
|
||||
const response = await databases.listDocuments(
|
||||
AppwriteIds.databaseId,
|
||||
AppwriteIds.collectionIdSkillTags
|
||||
);
|
||||
this.skillTags = response.documents as SkillTag[];
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch tasks', error);
|
||||
}
|
||||
},
|
||||
async addTask(task: Task) {
|
||||
try {
|
||||
const response = await databases.createDocument(
|
||||
|
||||
Reference in New Issue
Block a user