feat: Created task lists that work in categories
All checks were successful
Build and Push App Image / build-and-push (push) Successful in 1m20s
All checks were successful
Build and Push App Image / build-and-push (push) Successful in 1m20s
This commit is contained in:
@@ -13,12 +13,13 @@ export const useSpaceStore = defineStore("space", () => {
|
||||
const notesLoading = ref(false);
|
||||
const categories = ref([]);
|
||||
const categoryTree = ref([]);
|
||||
const taskLists = ref([]);
|
||||
const tasks = ref([]);
|
||||
const taskStatuses = ref([]);
|
||||
const noteLinkedTasks = ref([]);
|
||||
|
||||
const refreshSpaceData = async (spaceId) => {
|
||||
await Promise.all([fetchCategories(spaceId), fetchNotes(spaceId), fetchTaskStatuses(spaceId), fetchTasks(spaceId)]);
|
||||
await Promise.all([fetchCategories(spaceId), fetchNotes(spaceId), fetchTaskLists(spaceId), fetchTaskStatuses(spaceId), fetchTasks(spaceId)]);
|
||||
};
|
||||
|
||||
const fetchSpaces = async () => {
|
||||
@@ -227,6 +228,39 @@ export const useSpaceStore = defineStore("space", () => {
|
||||
}
|
||||
};
|
||||
|
||||
const fetchTaskLists = async (spaceId) => {
|
||||
if (!spaceId) {
|
||||
taskLists.value = [];
|
||||
return [];
|
||||
}
|
||||
try {
|
||||
const response = await apiClient.get(`/api/v1/spaces/${spaceId}/task-lists`);
|
||||
taskLists.value = response.data || [];
|
||||
return taskLists.value;
|
||||
} catch (error) {
|
||||
console.error("Error fetching task lists:", error);
|
||||
taskLists.value = [];
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
const createTaskList = async (spaceId, payload) => {
|
||||
const response = await apiClient.post(`/api/v1/spaces/${spaceId}/task-lists`, payload);
|
||||
await fetchTaskLists(spaceId);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const updateTaskList = async (spaceId, taskListId, payload) => {
|
||||
const response = await apiClient.put(`/api/v1/spaces/${spaceId}/task-lists/${taskListId}`, payload);
|
||||
await fetchTaskLists(spaceId);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const deleteTaskList = async (spaceId, taskListId) => {
|
||||
await apiClient.delete(`/api/v1/spaces/${spaceId}/task-lists/${taskListId}`);
|
||||
await fetchTaskLists(spaceId);
|
||||
};
|
||||
|
||||
const createTaskStatus = async (spaceId, payload) => {
|
||||
const response = await apiClient.post(`/api/v1/spaces/${spaceId}/task-statuses`, payload);
|
||||
await fetchTaskStatuses(spaceId);
|
||||
@@ -258,8 +292,8 @@ export const useSpaceStore = defineStore("space", () => {
|
||||
return [];
|
||||
}
|
||||
const params = {};
|
||||
if (filters.categoryId) {
|
||||
params.categoryId = filters.categoryId;
|
||||
if (filters.taskListId) {
|
||||
params.taskListId = filters.taskListId;
|
||||
}
|
||||
if (filters.statusId) {
|
||||
params.statusId = filters.statusId;
|
||||
@@ -344,6 +378,7 @@ export const useSpaceStore = defineStore("space", () => {
|
||||
notesLoading,
|
||||
categories,
|
||||
categoryTree,
|
||||
taskLists,
|
||||
tasks,
|
||||
taskStatuses,
|
||||
noteLinkedTasks,
|
||||
@@ -363,6 +398,10 @@ export const useSpaceStore = defineStore("space", () => {
|
||||
searchNotes,
|
||||
clearSearchResults,
|
||||
fetchTaskStatuses,
|
||||
fetchTaskLists,
|
||||
createTaskList,
|
||||
updateTaskList,
|
||||
deleteTaskList,
|
||||
createTaskStatus,
|
||||
updateTaskStatus,
|
||||
deleteTaskStatus,
|
||||
|
||||
Reference in New Issue
Block a user