Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/src/components/NoEbookFound.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const NoEbookFound = ({ bookId }) => {
color={grey[500]}
variant="h3"
>
{"This is no eBook for this title"}
{"There is no eBook for this title"}
</Typography>
<Typography
align="center"
Expand Down
12 changes: 8 additions & 4 deletions frontend/src/components/NotFound.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@ import { enqueueSnackbar } from "notistack";
const NotFound = ({
link = "shelves",
label = "shelf",
data = {},
labelPlural,
mutate = () => {},
}) => {
const handleClick = async () => {
const data = await fetcher.post(`${link}`, {
name: `A new ${label}`,
const response = await fetcher.post(`${link}`, {
...{
name: `A new ${label}`,
},
...data,
});

if (data.shelf) {
enqueueSnackbar(`Created a ${label} called ${data.shelf.name}`);
if (response.shelf) {
enqueueSnackbar(`Created a ${label} called ${response.shelf.name}`);
}

mutate();
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/routes/books.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ const BooksList = ({ filter }) => {
}

if (bookCards.length === 0) {
return <NotFound label="book" link="books" mutate={booksMutate} />;
return (
<NotFound
label="book"
link="books"
mutate={booksMutate}
data={{ title: "My First Book" }}
/>
);
}

return bookCards;
Expand Down
1 change: 0 additions & 1 deletion frontend/src/routes/scan.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ const Scan = () => {

const id = setInterval(processImage, 100);
return () => clearInterval(id);

}, [barcode]);

useEffect(() => {
Expand Down