diff --git a/reminder-dashboard/src/api.ts b/reminder-dashboard/src/api.ts index 086b7bc..bb336c3 100644 --- a/reminder-dashboard/src/api.ts +++ b/reminder-dashboard/src/api.ts @@ -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 = () => ({ diff --git a/reminder-dashboard/src/components/Guild/index.tsx b/reminder-dashboard/src/components/Guild/index.tsx index 957f6cd..631d0c2 100644 --- a/reminder-dashboard/src/components/Guild/index.tsx +++ b/reminder-dashboard/src/components/Guild/index.tsx @@ -5,6 +5,7 @@ import { createPortal, PropsWithChildren } from "preact/compat"; import { Import } from "../Import"; import { useGuild } from "../App/useGuild"; import { Link } from "wouter"; +import { usePathname } from "wouter/use-browser-location"; import "./index.scss"; @@ -18,13 +19,14 @@ export const Guild = ({ children }: PropsWithChildren) => { return ; } else { const importModal = createPortal(, document.getElementById("bottom-sidebar")); + const path = usePathname(); return ( <> {importModal}