fix: add some missing getBasedPath

This commit is contained in:
gauthier-th
2025-05-27 20:50:14 +02:00
parent 89c4e119fe
commit 2786424f70
7 changed files with 15 additions and 9 deletions

View File

@@ -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 }
: {},

View File

@@ -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 },
});
}}

View File

@@ -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 }
: {},

View File

@@ -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"

View File

@@ -68,7 +68,7 @@ const Setup = () => {
await axios.post('/api/v1/settings/main', { locale });
mutate('/api/v1/settings/public');
router.push('/');
router.push(getBasedPath('/'));
}
};

View File

@@ -718,7 +718,7 @@ const UserList = () => {
className="mr-2"
onClick={() =>
router.push(
'/users/[userId]/settings',
getBasedPath('/users/[userId]/settings'),
`/users/${user.id}/settings`
)
}

View File

@@ -11,13 +11,15 @@ const CollectionPage: NextPage<CollectionPageProps> = ({ collection }) => {
return <CollectionDetails collection={collection} />;
};
const API_BASE = process.env.NEXT_PUBLIC_BASE_PATH || '';
export const getServerSideProps: GetServerSideProps<
CollectionPageProps
> = async (ctx) => {
const response = await axios.get<Collection>(
`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 }