Skip to content

Commit

Permalink
feat: configure PWA with Vulcain
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentchalamon committed Aug 10, 2023
1 parent 69cd2f4 commit 61eba76
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pwa/pages/bookmarks/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const getServerSideProps: GetServerSideProps<{
const response: FetchResponse<PagedCollection<Bookmark>> | undefined = await fetch(`/bookmarks?page=${Number(page ?? 1)}`, {
headers: {
// @ts-ignore
Authorization: `Bearer ${session?.accessToken}`
Authorization: `Bearer ${session?.accessToken}`,
}
});
if (!response?.data) {
Expand Down
7 changes: 5 additions & 2 deletions pwa/pages/books/[id]/[slug]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ export const getServerSideProps: GetServerSideProps<{
page: number, // required for reviews pagination, prevents useRouter
}> = async ({ query: { id, page } }) => {
try {
const response: FetchResponse<Book> | undefined = await fetch(`/books/${id}`);
const response: FetchResponse<Book> | undefined = await fetch(`/books/${id}`, {
headers: {
Preload: "/books/*/reviews",
}
});
if (!response?.data) {
throw new Error(`Unable to retrieve data from /books/${id}.`);
}
console.log(response.data);

return { props: { data: response.data, hubURL: response.hubURL, page: page ? Number(page) : 1 } };
} catch (error) {
Expand Down
1 change: 0 additions & 1 deletion pwa/utils/book.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export const useOpenLibraryBook = <TData extends Book>(data: TData) => {
});
};

// @ts-ignore
const filterObject = (object: object) => Object.fromEntries(Object.entries(object).filter(([, value]) => {
return typeof value === "object" ? Object.keys(value).length > 0 : value?.length > 0;
}));
Expand Down

0 comments on commit 61eba76

Please sign in to comment.