mirror of
https://github.com/ershisan99/todolist_next.git
synced 2026-01-01 05:09:26 +00:00
lint and format
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { handleError } from "@/helpers";
|
||||
import { handleError } from "@/helpers"
|
||||
import type {
|
||||
CreateTaskResponse,
|
||||
CreateTodolistResponse,
|
||||
@@ -8,14 +8,14 @@ import type {
|
||||
TasksResponse,
|
||||
Todolist,
|
||||
UpdateTaskResponse,
|
||||
} from "@/services";
|
||||
import { todolistApiInstance } from "@/services/todolist-api/todolist-api.instance";
|
||||
} from "@/services"
|
||||
import { todolistApiInstance } from "@/services/todolist-api/todolist-api.instance"
|
||||
|
||||
export const TodolistAPI = {
|
||||
async getTodolists() {
|
||||
const res = await todolistApiInstance.get<Todolist[]>("/todolists");
|
||||
const res = await todolistApiInstance.get<Todolist[]>("/todolists")
|
||||
|
||||
return res.data;
|
||||
return res.data
|
||||
},
|
||||
|
||||
async createTodolist({ title }: { title: string }) {
|
||||
@@ -23,64 +23,64 @@ export const TodolistAPI = {
|
||||
"/todolists",
|
||||
{
|
||||
title,
|
||||
}
|
||||
);
|
||||
},
|
||||
)
|
||||
|
||||
return handleError(res.data);
|
||||
return handleError(res.data)
|
||||
},
|
||||
|
||||
async deleteTodolist({ todolistId }: { todolistId: string }) {
|
||||
const res = await todolistApiInstance.delete<DeleteTodolistResponse>(
|
||||
`/todolists/${todolistId}`
|
||||
);
|
||||
`/todolists/${todolistId}`,
|
||||
)
|
||||
|
||||
return res.data;
|
||||
return res.data
|
||||
},
|
||||
|
||||
async getTodolistTasks({ todolistId }: { todolistId: string }) {
|
||||
const res = await todolistApiInstance.get<TasksResponse>(
|
||||
`/todolists/${todolistId}/tasks`
|
||||
);
|
||||
`/todolists/${todolistId}/tasks`,
|
||||
)
|
||||
|
||||
return res.data;
|
||||
return res.data
|
||||
},
|
||||
|
||||
async createTask({
|
||||
todolistId,
|
||||
title,
|
||||
}: {
|
||||
todolistId: string;
|
||||
title: string;
|
||||
todolistId: string
|
||||
title: string
|
||||
}) {
|
||||
const res = await todolistApiInstance.post<CreateTaskResponse>(
|
||||
`/todolists/${todolistId}/tasks`,
|
||||
{ title }
|
||||
);
|
||||
{ title },
|
||||
)
|
||||
|
||||
return res.data;
|
||||
return res.data
|
||||
},
|
||||
|
||||
async updateTask({ todolistId, task }: { todolistId: string; task: Task }) {
|
||||
const { id, ...rest } = task;
|
||||
const { id, ...rest } = task
|
||||
const res = await todolistApiInstance.patch<UpdateTaskResponse>(
|
||||
`/todolists/${todolistId}/tasks/${id}`,
|
||||
rest
|
||||
);
|
||||
rest,
|
||||
)
|
||||
|
||||
return res.data;
|
||||
return res.data
|
||||
},
|
||||
|
||||
async deleteTask({
|
||||
todolistId,
|
||||
taskId,
|
||||
}: {
|
||||
todolistId: string;
|
||||
taskId: string;
|
||||
todolistId: string
|
||||
taskId: string
|
||||
}) {
|
||||
const res = await todolistApiInstance.delete<DeleteTaskResponse>(
|
||||
`/todolists/${todolistId}/tasks/${taskId}`
|
||||
);
|
||||
`/todolists/${todolistId}/tasks/${taskId}`,
|
||||
)
|
||||
|
||||
return res.data;
|
||||
return res.data
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user