Add delete/patch todos

This commit is contained in:
jude
2024-04-10 18:42:29 +01:00
parent 4063334953
commit 24e316b12f
5 changed files with 85 additions and 13 deletions

View File

@ -49,7 +49,7 @@ export type Reminder = {
};
export type Todo = {
id: string;
id: number;
channel_id: string;
value: string;
};
@ -59,6 +59,10 @@ export type CreateTodo = {
value: string;
};
export type UpdateTodo = {
value: string;
};
export type ChannelInfo = {
id: string;
name: string;
@ -210,7 +214,7 @@ export const fetchGuildTodos = (guild: string) => ({
});
export const patchGuildTodo = (guild: string) => ({
mutationFn: (todo: Todo) => axios.patch(`/dashboard/api/guild/${guild}/todos`, todo),
mutationFn: ({ id, todo }) => axios.patch(`/dashboard/api/guild/${guild}/todos/${id}`, todo),
});
export const postGuildTodo = (guild: string) => ({