* refactor: switch ExternalAPI to Fetch API * fix: add missing auth token in Plex request * fix: send proper URL params * ci: try to fix format checker * ci: ci: try to fix format checker * ci: try to fix format checker * refactor: make tautulli use the ExternalAPI class * refactor: add rate limit to fetch api * refactor: add rate limit to fetch api * refactor: switch server from axios to fetch api * refactor: switch frontend from axios to fetch api * fix: switch from URL objects to strings * fix: use the right search params for ExternalAPI * fix: better log for ExternalAPI errors * feat: add retry to external API requests * fix: try to fix network errors with IPv6 * fix: imageProxy rate limit * revert: remove retry to external API requests * feat: set IPv4 first as an option * fix(jellyfinapi): add missing argument in JellyfinAPI constructor * refactor: clean the rate limit utility
37 lines
914 B
TypeScript
37 lines
914 B
TypeScript
import CollectionDetails from '@app/components/CollectionDetails';
|
|
import type { Collection } from '@server/models/Collection';
|
|
import type { GetServerSideProps, NextPage } from 'next';
|
|
|
|
interface CollectionPageProps {
|
|
collection?: Collection;
|
|
}
|
|
|
|
const CollectionPage: NextPage<CollectionPageProps> = ({ collection }) => {
|
|
return <CollectionDetails collection={collection} />;
|
|
};
|
|
|
|
export const getServerSideProps: GetServerSideProps<
|
|
CollectionPageProps
|
|
> = async (ctx) => {
|
|
const res = await fetch(
|
|
`http://localhost:${process.env.PORT || 5055}/api/v1/collection/${
|
|
ctx.query.collectionId
|
|
}`,
|
|
{
|
|
headers: ctx.req?.headers?.cookie
|
|
? { cookie: ctx.req.headers.cookie }
|
|
: undefined,
|
|
}
|
|
);
|
|
if (!res.ok) throw new Error();
|
|
const collection: Collection = await res.json();
|
|
|
|
return {
|
|
props: {
|
|
collection,
|
|
},
|
|
};
|
|
};
|
|
|
|
export default CollectionPage;
|