Skip to content

Commit

Permalink
fix: use correct path value in delete request
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanaturner authored and jakeaturner committed Aug 28, 2024
1 parent 14a989e commit 8b51d1f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion server/util/bookutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,17 @@ export const deleteBookFromAPI = async (bookID) => {
if (!url.pathname) {
throw new Error('link parsing failed');
}
const pathParts = url.pathname.match(/(Courses|Bookshelves|home)/);
if (pathParts?.length < 1) {
throw new Error('invalid path');
}
const path = pathParts[0];

await axios.put(
`https://api.libretexts.org/endpoint/refreshListRemove`,
{
id,
path: url.pathname,
path,
subdomain,
},
{
Expand Down

0 comments on commit 8b51d1f

Please sign in to comment.