Start work on todo list support for dashboard
This commit is contained in:
@ -49,6 +49,12 @@ export type Reminder = {
|
||||
utc_time: string;
|
||||
};
|
||||
|
||||
export type Todo = {
|
||||
id: string;
|
||||
channel_id: string;
|
||||
value: string;
|
||||
};
|
||||
|
||||
export type ChannelInfo = {
|
||||
id: string;
|
||||
name: string;
|
||||
@ -190,6 +196,33 @@ export const deleteGuildTemplate = (guild: string) => ({
|
||||
}),
|
||||
});
|
||||
|
||||
export const fetchGuildTodos = (guild: string) => ({
|
||||
queryKey: ["GUILD_TODOS", guild],
|
||||
queryFn: () =>
|
||||
axios.get(`/dashboard/api/guild/${guild}/todos`).then((resp) => resp.data) as Promise<
|
||||
Todo[]
|
||||
>,
|
||||
staleTime: OTHER_STALE_TIME,
|
||||
});
|
||||
|
||||
export const patchGuildTodo = (guild: string) => ({
|
||||
mutationFn: (todo: Todo) => axios.patch(`/dashboard/api/guild/${guild}/todos`, todo),
|
||||
});
|
||||
|
||||
export const postGuildTodo = (guild: string) => ({
|
||||
mutationFn: (reminder: Reminder) =>
|
||||
axios.post(`/dashboard/api/guild/${guild}/todos`, reminder).then((resp) => resp.data),
|
||||
});
|
||||
|
||||
export const deleteGuildTodo = () => ({
|
||||
mutationFn: (todo: Todo) =>
|
||||
axios.delete(`/dashboard/api/todos`, {
|
||||
data: {
|
||||
id: todo.id,
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
||||
export const fetchUserReminders = () => ({
|
||||
queryKey: ["USER_REMINDERS"],
|
||||
queryFn: () =>
|
||||
|
Reference in New Issue
Block a user