diff --git a/src/components/Blacklist/index.tsx b/src/components/Blacklist/index.tsx index 2713544f..c44681dc 100644 --- a/src/components/Blacklist/index.tsx +++ b/src/components/Blacklist/index.tsx @@ -12,6 +12,7 @@ import { Permission, useUser } from '@app/hooks/useUser'; import globalMessages from '@app/i18n/globalMessages'; import Error from '@app/pages/_error'; import defineMessages from '@app/utils/defineMessages'; +import { getBasedPath } from '@app/utils/navigationUtil'; import { ChevronLeftIcon, ChevronRightIcon, @@ -122,7 +123,7 @@ const Blacklist = () => { onChange={(e) => { setCurrentFilter(e.target.value as Filter); router.push({ - pathname: router.pathname, + pathname: getBasedPath(router.pathname), query: router.query.userId ? { userId: router.query.userId } : {}, diff --git a/src/components/MovieDetails/index.tsx b/src/components/MovieDetails/index.tsx index 80ede2d0..ce0d9071 100644 --- a/src/components/MovieDetails/index.tsx +++ b/src/components/MovieDetails/index.tsx @@ -30,6 +30,7 @@ import globalMessages from '@app/i18n/globalMessages'; import ErrorPage from '@app/pages/_error'; import { sortCrewPriority } from '@app/utils/creditHelpers'; import defineMessages from '@app/utils/defineMessages'; +import { getBasedPath } from '@app/utils/navigationUtil'; import { refreshIntervalHelper } from '@app/utils/refreshIntervalHelper'; import { ArrowRightCircleIcon, @@ -468,7 +469,7 @@ const MovieDetails = ({ movie }: MovieDetailsProps) => { onClose={() => { setShowManager(false); router.push({ - pathname: router.pathname, + pathname: getBasedPath(router.pathname), query: { movieId: router.query.movieId }, }); }} diff --git a/src/components/RequestList/index.tsx b/src/components/RequestList/index.tsx index 7ce48eb3..1207c57f 100644 --- a/src/components/RequestList/index.tsx +++ b/src/components/RequestList/index.tsx @@ -8,6 +8,7 @@ import { useUpdateQueryParams } from '@app/hooks/useUpdateQueryParams'; import { useUser } from '@app/hooks/useUser'; import globalMessages from '@app/i18n/globalMessages'; import defineMessages from '@app/utils/defineMessages'; +import { getBasedPath } from '@app/utils/navigationUtil'; import { ArrowDownIcon, ArrowUpIcon, @@ -173,7 +174,7 @@ const RequestList = () => { onChange={(e) => { setCurrentMediaType(e.target.value as MediaType); router.push({ - pathname: router.pathname, + pathname: getBasedPath(router.pathname), query: router.query.userId ? { userId: router.query.userId } : {}, @@ -203,7 +204,7 @@ const RequestList = () => { onChange={(e) => { setCurrentFilter(e.target.value as Filter); router.push({ - pathname: router.pathname, + pathname: getBasedPath(router.pathname), query: router.query.userId ? { userId: router.query.userId } : {}, @@ -251,7 +252,7 @@ const RequestList = () => { onChange={(e) => { setCurrentSort(e.target.value as Sort); router.push({ - pathname: router.pathname, + pathname: getBasedPath(router.pathname), query: router.query.userId ? { userId: router.query.userId } : {}, diff --git a/src/components/Settings/SettingsLogs/index.tsx b/src/components/Settings/SettingsLogs/index.tsx index 4fbcafc0..b6d0d577 100644 --- a/src/components/Settings/SettingsLogs/index.tsx +++ b/src/components/Settings/SettingsLogs/index.tsx @@ -10,6 +10,7 @@ import { useUpdateQueryParams } from '@app/hooks/useUpdateQueryParams'; import globalMessages from '@app/i18n/globalMessages'; import Error from '@app/pages/_error'; import defineMessages from '@app/utils/defineMessages'; +import { getBasedPath } from '@app/utils/navigationUtil'; import { Transition } from '@headlessui/react'; import { ChevronLeftIcon, @@ -286,7 +287,7 @@ const SettingsLogs = () => { name="filter" onChange={(e) => { setCurrentFilter(e.target.value as Filter); - router.push(router.pathname); + router.push(getBasedPath(router.pathname)); }} value={currentFilter} className="rounded-r-only" diff --git a/src/components/Setup/index.tsx b/src/components/Setup/index.tsx index e00c4381..1c09ab98 100644 --- a/src/components/Setup/index.tsx +++ b/src/components/Setup/index.tsx @@ -68,7 +68,7 @@ const Setup = () => { await axios.post('/api/v1/settings/main', { locale }); mutate('/api/v1/settings/public'); - router.push('/'); + router.push(getBasedPath('/')); } }; diff --git a/src/components/UserList/index.tsx b/src/components/UserList/index.tsx index 43214880..337c695d 100644 --- a/src/components/UserList/index.tsx +++ b/src/components/UserList/index.tsx @@ -718,7 +718,7 @@ const UserList = () => { className="mr-2" onClick={() => router.push( - '/users/[userId]/settings', + getBasedPath('/users/[userId]/settings'), `/users/${user.id}/settings` ) } diff --git a/src/pages/collection/[collectionId]/index.tsx b/src/pages/collection/[collectionId]/index.tsx index e555e41e..1ffeb00e 100644 --- a/src/pages/collection/[collectionId]/index.tsx +++ b/src/pages/collection/[collectionId]/index.tsx @@ -11,13 +11,15 @@ const CollectionPage: NextPage = ({ collection }) => { return ; }; +const API_BASE = process.env.NEXT_PUBLIC_BASE_PATH || ''; + export const getServerSideProps: GetServerSideProps< CollectionPageProps > = async (ctx) => { const response = await axios.get( `http://${process.env.HOST || 'localhost'}:${ process.env.PORT || 5055 - }/api/v1/collection/${ctx.query.collectionId}`, + }${API_BASE}/api/v1/collection/${ctx.query.collectionId}`, { headers: ctx.req?.headers?.cookie ? { cookie: ctx.req.headers.cookie }