MCPcopy
hub / github.com/Peppermint-Lab/peppermint / deleteNotebook

Function deleteNotebook

apps/client/components/NotebookEditor/index.tsx:105–126  ·  view source on GitHub ↗
(id)

Source from the content-addressed store, hash-verified

103 }
104
105 async function deleteNotebook(id) {
106 if (window.confirm("Do you really want to delete this notebook?")) {
107 await fetch(`/api/v1/notebooks/note/${router.query.id}`, {
108 method: "DELETE",
109 headers: {
110 Authorization: `Bearer ${token}`,
111 },
112 })
113 .then((res) => res.json())
114 .then((res) => {
115 if (res.success) {
116 router.push("/documents");
117 } else {
118 toast({
119 variant: "destructive",
120 title: "Error -> Unable to delete",
121 description: res.message,
122 });
123 }
124 });
125 }
126 }
127
128 useEffect(() => {
129 fetchNotebook();

Callers 1

NotebookEditorFunction · 0.85

Calls 1

toastFunction · 0.90

Tested by

no test coverage detected