More work on todo list

This commit is contained in:
jude
2024-04-09 21:21:46 +01:00
parent e128b9848f
commit 4063334953
7 changed files with 242 additions and 49 deletions

View File

@ -54,6 +54,11 @@ export type Todo = {
value: string;
};
export type CreateTodo = {
channel_id: string;
value: string;
};
export type ChannelInfo = {
id: string;
name: string;
@ -209,17 +214,12 @@ export const patchGuildTodo = (guild: string) => ({
});
export const postGuildTodo = (guild: string) => ({
mutationFn: (reminder: Reminder) =>
axios.post(`/dashboard/api/guild/${guild}/todos`, reminder).then((resp) => resp.data),
mutationFn: (todo: CreateTodo) =>
axios.post(`/dashboard/api/guild/${guild}/todos`, todo).then((resp) => resp.data),
});
export const deleteGuildTodo = () => ({
mutationFn: (todo: Todo) =>
axios.delete(`/dashboard/api/todos`, {
data: {
id: todo.id,
},
}),
export const deleteGuildTodo = (guild: string) => ({
mutationFn: (todoId: number) => axios.delete(`/dashboard/api/guild/${guild}/todos/${todoId}`),
});
export const fetchUserReminders = () => ({