refactor: reduce responsability of individual parts
This commit is contained in:
@@ -1,16 +1,6 @@
|
||||
import type { RawTask, Task, TaskCreateData, TaskUpdateData } from "@/types";
|
||||
import { parseTask } from "@/lib/tasks";
|
||||
import type { Task, TaskCreateData, TaskUpdateData } from "@/types";
|
||||
|
||||
function parseTask(task: RawTask): Task {
|
||||
return {
|
||||
id: task.id,
|
||||
name: task.name,
|
||||
reset_cron: task.reset_cron,
|
||||
check_date: task.check_date ? new Date(task.check_date) : null,
|
||||
previous_check_date: task.previous_check_date
|
||||
? new Date(task.previous_check_date)
|
||||
: null,
|
||||
};
|
||||
}
|
||||
|
||||
export async function getTasks(list: string): Promise<Task[]> {
|
||||
const response = await fetch(`/api/lists/${list}/tasks`);
|
||||
|
||||
Reference in New Issue
Block a user