diff --git a/src/app/AppContainer.tsx b/src/app/AppContainer.tsx index e165ab6d..3aab16eb 100644 --- a/src/app/AppContainer.tsx +++ b/src/app/AppContainer.tsx @@ -3,17 +3,17 @@ import * as React from 'react'; import { Box, LinearProgress } from '@mui/material'; import type ContextProviderProps from './interface/ContextProviderProps'; -import { useLocation } from 'react-router-dom'; +import { usePathname } from 'next/navigation'; import { selectLoadingApp } from './store/selectors'; import { useSelector } from 'react-redux'; const AppContainer: React.FC = ({ children }) => { const isAppLoading = useSelector(selectLoadingApp); - const location = useLocation(); + const pathname = usePathname(); React.useLayoutEffect(() => { window.scrollTo({ top: 0, left: 0, behavior: 'instant' }); - }, [location.pathname]); + }, [pathname]); return ( <> diff --git a/src/app/screens/Analytics/GBFSFeedAnalytics/GBFSFeedAnalyticsTable.tsx b/src/app/screens/Analytics/GBFSFeedAnalytics/GBFSFeedAnalyticsTable.tsx index 5a19450a..450df9fa 100644 --- a/src/app/screens/Analytics/GBFSFeedAnalytics/GBFSFeedAnalyticsTable.tsx +++ b/src/app/screens/Analytics/GBFSFeedAnalytics/GBFSFeedAnalyticsTable.tsx @@ -2,7 +2,7 @@ import React, { useMemo } from 'react'; import { type MRT_Cell, type MRT_ColumnDef } from 'material-react-table'; import { format } from 'date-fns'; import { type GBFSFeedMetrics } from '../types'; -import { useNavigate } from 'react-router-dom'; +import { useRouter } from 'next/navigation'; import { Box } from '@mui/material'; import { OpenInNew } from '@mui/icons-material'; @@ -13,7 +13,7 @@ import { OpenInNew } from '@mui/icons-material'; export const useTableColumns = (): Array< MRT_ColumnDef > => { - const navigate = useNavigate(); + const router = useRouter(); return useMemo< Array> @@ -98,7 +98,7 @@ export const useTableColumns = (): Array< }} className={'navigable-list-item'} onClick={() => { - navigate(`/metrics/gbfs/versions?version=${version}`); + router.push(`/metrics/gbfs/versions?version=${version}`); }} > {version} @@ -147,6 +147,6 @@ export const useTableColumns = (): Array< size: 200, }, ], - [navigate], + [router], ); }; diff --git a/src/app/screens/Analytics/GBFSFeedAnalytics/index.tsx b/src/app/screens/Analytics/GBFSFeedAnalytics/index.tsx index d9ab0fe3..002eb90b 100644 --- a/src/app/screens/Analytics/GBFSFeedAnalytics/index.tsx +++ b/src/app/screens/Analytics/GBFSFeedAnalytics/index.tsx @@ -25,7 +25,7 @@ import { } from '@mui/material'; import '../analytics.css'; -import { useLocation } from 'react-router-dom'; +import { useSearchParams } from 'next/navigation'; import { fetchAvailableFilesStart, selectFile, @@ -46,16 +46,15 @@ export const getAnalyticsBucketEndpoint = (): string | undefined => globalAnalyticsBucketEndpoint; export default function GBFSFeedAnalytics(): React.ReactElement { - const { search } = useLocation(); - const params = new URLSearchParams(search); + const searchParams = useSearchParams(); const { config } = useRemoteConfig(); const [schemaPathFilters, setSchemaPathFilters] = React.useState( [], ); - const versionFilter = params.get('version'); + const versionFilter = searchParams.get('version'); const schemaPathInitFilter = decodeURIComponent( - params.get('schemaPath') ?? '', + searchParams.get('schemaPath') ?? '', ); const dispatch = useDispatch(); diff --git a/src/app/screens/Analytics/GBFSNoticeAnalytics/index.tsx b/src/app/screens/Analytics/GBFSNoticeAnalytics/index.tsx index 5f39189d..d22ce419 100644 --- a/src/app/screens/Analytics/GBFSNoticeAnalytics/index.tsx +++ b/src/app/screens/Analytics/GBFSNoticeAnalytics/index.tsx @@ -1,5 +1,5 @@ import { useState, useEffect, useMemo } from 'react'; -import { useLocation, useNavigate } from 'react-router-dom'; +import { useSearchParams, useRouter } from 'next/navigation'; import { MaterialReactTable, @@ -27,10 +27,9 @@ import { type GBFSNoticeMetrics } from '../types'; import { useRemoteConfig } from '../../../context/RemoteConfigProvider'; export default function GBFSNoticeAnalytics(): React.ReactElement { - const navigateTo = useNavigate(); - const { search } = useLocation(); - const params = new URLSearchParams(search); - const noticeCode = params.get('noticeCode'); + const router = useRouter(); + const searchParams = useSearchParams(); + const noticeCode = searchParams.get('noticeCode'); const [data, setData] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); @@ -191,7 +190,7 @@ export default function GBFSNoticeAnalytics(): React.ReactElement { sx={{ mb: 2 }} startIcon={} onClick={() => { - navigateTo( + router.push( `/metrics/gbfs/feeds?schemaPath=${encodeURIComponent( metrics.schema_path, )}`, diff --git a/src/app/screens/Analytics/GBFSVersionAnalytics/index.tsx b/src/app/screens/Analytics/GBFSVersionAnalytics/index.tsx index 8d042a7c..0beb652a 100644 --- a/src/app/screens/Analytics/GBFSVersionAnalytics/index.tsx +++ b/src/app/screens/Analytics/GBFSVersionAnalytics/index.tsx @@ -1,5 +1,5 @@ import { useState, useEffect, useMemo } from 'react'; -import { useLocation, useNavigate } from 'react-router-dom'; +import { useSearchParams, useRouter } from 'next/navigation'; import { MaterialReactTable, @@ -36,13 +36,13 @@ import MUITooltip from '@mui/material/Tooltip'; import { GBFS_LINK } from '../../../constants/Navigation'; export default function GBFSVersionAnalytics(): React.ReactElement { - const navigateTo = useNavigate(); + const router = useRouter(); const [data, setData] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); const { config } = useRemoteConfig(); - const params = new URLSearchParams(useLocation().search); - const versionFilter = params.get('version'); + const searchParams = useSearchParams(); + const versionFilter = searchParams.get('version'); const initialFilter = useMemo(() => { if (versionFilter != null) { return [{ id: 'version', value: versionFilter }]; @@ -131,7 +131,7 @@ export default function GBFSVersionAnalytics(): React.ReactElement { }, }, ], - [data, navigateTo], + [data, router], ); const table = useMaterialReactTable({ @@ -214,7 +214,7 @@ export default function GBFSVersionAnalytics(): React.ReactElement { sx={{ mb: 2 }} startIcon={} onClick={() => { - navigateTo(`/metrics/gbfs/feeds?version=${metrics.version}`); + router.push(`/metrics/gbfs/feeds?version=${metrics.version}`); }} > Show Feeds diff --git a/src/app/screens/Analytics/GTFSFeatureAnalytics/index.tsx b/src/app/screens/Analytics/GTFSFeatureAnalytics/index.tsx index 343ee537..c83bdfa9 100644 --- a/src/app/screens/Analytics/GTFSFeatureAnalytics/index.tsx +++ b/src/app/screens/Analytics/GTFSFeatureAnalytics/index.tsx @@ -1,5 +1,5 @@ import { useState, useEffect, useMemo } from 'react'; -import { useLocation, useNavigate } from 'react-router-dom'; +import { useSearchParams, useRouter } from 'next/navigation'; import { MaterialReactTable, type MRT_ColumnDef, @@ -38,10 +38,9 @@ import { } from '../../../utils/consts'; export default function GTFSFeatureAnalytics(): React.ReactElement { - const navigateTo = useNavigate(); - const { search } = useLocation(); - const params = new URLSearchParams(search); - const featureName = params.get('featureName'); + const router = useRouter(); + const searchParams = useSearchParams(); + const featureName = searchParams.get('featureName'); const [data, setData] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); @@ -281,7 +280,7 @@ export default function GTFSFeatureAnalytics(): React.ReactElement { sx={{ mb: 2 }} startIcon={} onClick={() => { - navigateTo( + router.push( `/metrics/gtfs/feeds?featureName=${metrics.feature}`, ); }} diff --git a/src/app/screens/Analytics/GTFSFeedAnalytics/GTFSFeedAnalyticsTable.tsx b/src/app/screens/Analytics/GTFSFeedAnalytics/GTFSFeedAnalyticsTable.tsx index 8b621c36..018f9c30 100644 --- a/src/app/screens/Analytics/GTFSFeedAnalytics/GTFSFeedAnalyticsTable.tsx +++ b/src/app/screens/Analytics/GTFSFeedAnalytics/GTFSFeedAnalyticsTable.tsx @@ -2,7 +2,7 @@ import React, { useMemo } from 'react'; import { type MRT_Cell, type MRT_ColumnDef } from 'material-react-table'; import { format } from 'date-fns'; import { type GTFSFeedMetrics } from '../types'; -import { useNavigate } from 'react-router-dom'; +import { useRouter } from 'next/navigation'; import { Box, IconButton, MenuItem, Stack, Tooltip } from '@mui/material'; import { OpenInNew } from '@mui/icons-material'; import { @@ -30,7 +30,7 @@ export const useTableColumns = ( avgWarnings: number, avgInfos: number, ): Array> => { - const navigate = useNavigate(); + const router = useRouter(); return useMemo>>( () => [ @@ -166,7 +166,7 @@ export const useTableColumns = ( }} className={'navigable-list-item'} onClick={() => { - navigate(`/metrics/gtfs/notices?noticeCode=${error}`); + router.push(`/metrics/gtfs/notices?noticeCode=${error}`); }} > {error} @@ -208,7 +208,7 @@ export const useTableColumns = ( }} className={'navigable-list-item'} onClick={() => { - navigate(`/metrics/gtfs/notices?noticeCode=${warning}`); + router.push(`/metrics/gtfs/notices?noticeCode=${warning}`); }} > {warning} @@ -258,7 +258,7 @@ export const useTableColumns = ( }} className={'navigable-list-item'} onClick={() => { - navigate(`/metrics/gtfs/notices?noticeCode=${info}`); + router.push(`/metrics/gtfs/notices?noticeCode=${info}`); }} > {info} @@ -318,7 +318,7 @@ export const useTableColumns = ( style={{ cursor: 'pointer', marginLeft: '10px' }} className={'navigable-list-item'} onClick={() => { - navigate( + router.push( `/metrics/gtfs/features?featureName=${featureData.feature}`, ); }} @@ -349,7 +349,7 @@ export const useTableColumns = ( }, ], [ - navigate, + router, uniqueErrors, uniqueWarnings, uniqueInfos, diff --git a/src/app/screens/Analytics/GTFSFeedAnalytics/index.tsx b/src/app/screens/Analytics/GTFSFeedAnalytics/index.tsx index b455df61..37bc6702 100644 --- a/src/app/screens/Analytics/GTFSFeedAnalytics/index.tsx +++ b/src/app/screens/Analytics/GTFSFeedAnalytics/index.tsx @@ -19,7 +19,7 @@ import { } from '@mui/material'; import '../analytics.css'; -import { useLocation } from 'react-router-dom'; +import { useSearchParams } from 'next/navigation'; import { fetchAvailableFilesStart, selectFile, @@ -42,13 +42,12 @@ export const getAnalyticsBucketEndpoint = (): string | undefined => globalAnalyticsBucketEndpoint; export default function GTFSFeedAnalytics(): React.ReactElement { - const { search } = useLocation(); - const params = new URLSearchParams(search); + const searchParams = useSearchParams(); const { config } = useRemoteConfig(); - const severity = params.get('severity'); - const noticeCode = params.get('noticeCode'); - const featureName = params.get('featureName'); + const severity = searchParams.get('severity'); + const noticeCode = searchParams.get('noticeCode'); + const featureName = searchParams.get('featureName'); const dispatch = useDispatch(); const data = useSelector(selectGTFSFeedMetrics); diff --git a/src/app/screens/Analytics/GTFSNoticeAnalytics/index.tsx b/src/app/screens/Analytics/GTFSNoticeAnalytics/index.tsx index d051d529..ee5dfb47 100644 --- a/src/app/screens/Analytics/GTFSNoticeAnalytics/index.tsx +++ b/src/app/screens/Analytics/GTFSNoticeAnalytics/index.tsx @@ -1,5 +1,5 @@ import { useState, useEffect, useMemo } from 'react'; -import { useLocation, useNavigate } from 'react-router-dom'; +import { useSearchParams, useRouter } from 'next/navigation'; import { MaterialReactTable, @@ -36,10 +36,9 @@ import { WEB_VALIDATOR_LINK } from '../../../constants/Navigation'; import { useRemoteConfig } from '../../../context/RemoteConfigProvider'; export default function GTFSNoticeAnalytics(): React.ReactElement { - const navigateTo = useNavigate(); - const { search } = useLocation(); - const params = new URLSearchParams(search); - const noticeCode = params.get('noticeCode'); + const router = useRouter(); + const searchParams = useSearchParams(); + const noticeCode = searchParams.get('noticeCode'); const [data, setData] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); @@ -251,7 +250,7 @@ export default function GTFSNoticeAnalytics(): React.ReactElement { sx={{ mb: 2 }} startIcon={} onClick={() => { - navigateTo( + router.push( `/metrics/gtfs/feeds?severity=${metrics.severity}¬iceCode=${metrics.notice}`, ); }} diff --git a/src/app/screens/CompleteRegistration.tsx b/src/app/screens/CompleteRegistration.tsx index 666903f1..3ef32beb 100644 --- a/src/app/screens/CompleteRegistration.tsx +++ b/src/app/screens/CompleteRegistration.tsx @@ -16,7 +16,7 @@ import { } from '@mui/material'; import { useAppDispatch } from '../hooks'; import { refreshUserInformation } from '../store/profile-reducer'; -import { useNavigate, useSearchParams } from 'react-router-dom'; +import { useRouter, useSearchParams } from 'next/navigation'; import { selectUserProfileStatus, selectRegistrationError, @@ -28,13 +28,13 @@ export default function CompleteRegistration(): React.ReactElement { const auth = getAuth(); const user = auth.currentUser; const dispatch = useAppDispatch(); - const navigateTo = useNavigate(); + const router = useRouter(); const userProfileStatus = useSelector(selectUserProfileStatus); const registrationError = useSelector(selectRegistrationError); const [isSubmitted, setIsSubmitted] = React.useState(false); - const [searchParams] = useSearchParams(); + const searchParams = useSearchParams(); const termsAndConditionsElement = ( @@ -67,9 +67,9 @@ export default function CompleteRegistration(): React.ReactElement { React.useEffect(() => { if (userProfileStatus === 'registered') { if (searchParams.has('add_feed')) { - navigateTo(ADD_FEED_TARGET, { state: { from: 'registration' } }); + router.push(ADD_FEED_TARGET + '?from=registration'); } else { - navigateTo(ACCOUNT_TARGET); + router.push(ACCOUNT_TARGET); } } }, [userProfileStatus]); diff --git a/src/app/screens/FeedSubmission/index.tsx b/src/app/screens/FeedSubmission/index.tsx index ac63a2dc..c4f57d47 100644 --- a/src/app/screens/FeedSubmission/index.tsx +++ b/src/app/screens/FeedSubmission/index.tsx @@ -11,15 +11,15 @@ import { import CheckIcon from '@mui/icons-material/Check'; import { selectIsAuthenticated } from '../../store/profile-selectors'; import { useTranslations } from 'next-intl'; -import { useLocation } from 'react-router-dom'; +import { useSearchParams } from 'next/navigation'; import FeedSubmissionForm from './Form'; import { ColoredContainer } from '../../styles/PageLayout.style'; function Component(): React.ReactElement { const t = useTranslations('feeds'); - const location = useLocation(); + const searchParams = useSearchParams(); const [showLoginSuccess, setShowLoginSuccess] = React.useState( - location.state?.from === 'registration', + searchParams.get('from') === 'registration', ); const isAuthenticated = useSelector(selectIsAuthenticated); diff --git a/src/app/screens/Feeds/SearchTable.tsx b/src/app/screens/Feeds/SearchTable.tsx index b2652ad5..2d2b83ce 100644 --- a/src/app/screens/Feeds/SearchTable.tsx +++ b/src/app/screens/Feeds/SearchTable.tsx @@ -20,7 +20,7 @@ import { } from '../../services/feeds/utils'; import { useTranslations } from 'next-intl'; import GtfsRtEntities from './GtfsRtEntities'; -import { Link } from 'react-router-dom'; +import Link from 'next/link'; import { getEmojiFlag, type TCountryCode } from 'countries-list'; import OfficialChip from '../../components/OfficialChip'; import ProviderTitle from './ProviderTitle'; @@ -138,7 +138,7 @@ export default function SearchTable({ { if (userProfileStatus === 'registered') { - navigateTo(ACCOUNT_TARGET); + router.push(ACCOUNT_TARGET); } if (userProfileStatus === 'authenticated') { - navigateTo(COMPLETE_REGISTRATION_TARGET); + router.push(COMPLETE_REGISTRATION_TARGET); } }, [userProfileStatus]); diff --git a/src/app/screens/GbfsValidator/GbfsFeedSearchInput.tsx b/src/app/screens/GbfsValidator/GbfsFeedSearchInput.tsx index 313f7a21..31e0fbb2 100644 --- a/src/app/screens/GbfsValidator/GbfsFeedSearchInput.tsx +++ b/src/app/screens/GbfsValidator/GbfsFeedSearchInput.tsx @@ -15,7 +15,7 @@ import { } from '@mui/material'; import SearchIcon from '@mui/icons-material/Search'; import { useEffect, useState } from 'react'; -import { useNavigate } from 'react-router-dom'; +import { useRouter } from 'next/navigation'; import { AuthTypeEnum, useGbfsAuth } from '../../context/GbfsAuthProvider'; import { useSelector } from 'react-redux'; import { selectGbfsValidationParams } from '../../store/gbfs-validator-selectors'; @@ -31,7 +31,7 @@ export default function GbfsFeedSearchInput({ }: GbfsFeedSearchInputProps): React.ReactElement { const lastSearchParams = useSelector(selectGbfsValidationParams); const theme = useTheme(); - const navigate = useNavigate(); + const router = useRouter(); const { auth, setAuth } = useGbfsAuth(); const [autoDiscoveryUrlInput, setAutoDiscoveryUrlInput] = useState( initialFeedUrl ?? '', @@ -144,7 +144,7 @@ export default function GbfsFeedSearchInput({ triggerDataFetch(); return; } - navigate( + router.push( `/gbfs-validator?AutoDiscoveryUrl=${encodeURIComponent( autoDiscoveryUrlInput, )}`, diff --git a/src/app/screens/GbfsValidator/ValidationState.tsx b/src/app/screens/GbfsValidator/ValidationState.tsx index a87503c9..c2f1ce7a 100644 --- a/src/app/screens/GbfsValidator/ValidationState.tsx +++ b/src/app/screens/GbfsValidator/ValidationState.tsx @@ -15,7 +15,7 @@ import { gbfsValidatorHeroBg } from './ValidationReport.styles'; import ValidationReport from './ValidationReport'; import { useSelector, useDispatch } from 'react-redux'; import { validateStart } from '../../store/gbfs-validator-reducer'; -import { useNavigate, useSearchParams } from 'react-router-dom'; +import { useRouter, useSearchParams } from 'next/navigation'; import { selectGbfsValidationError, selectGbfsValidationLoading, @@ -27,8 +27,8 @@ import { groupErrorsByFile } from './errorGrouping'; export default function ValidationState(): ReactElement { const theme = useTheme(); - const navigate = useNavigate(); - const [searchParams] = useSearchParams(); + const router = useRouter(); + const searchParams = useSearchParams(); const [longLoadingState, setLongLoadingState] = useState(false); const { auth } = useGbfsAuth(); const loadingState = useSelector(selectGbfsValidationLoading); @@ -80,7 +80,7 @@ export default function ValidationState(): ReactElement { if (feedUrl !== null && feedUrl !== '') { dispatch(validateStart({ feedUrl, auth })); } else { - navigate('/gbfs-validator'); + router.push('/gbfs-validator'); } }; diff --git a/src/app/screens/GbfsValidator/index.tsx b/src/app/screens/GbfsValidator/index.tsx index 07c745e4..f37cad28 100644 --- a/src/app/screens/GbfsValidator/index.tsx +++ b/src/app/screens/GbfsValidator/index.tsx @@ -2,7 +2,7 @@ import { OpenInNew } from '@mui/icons-material'; import { Box, Button, Link, Typography, useTheme } from '@mui/material'; import React, { useEffect } from 'react'; import GbfsFeedSearchInput from './GbfsFeedSearchInput'; -import { useSearchParams } from 'react-router-dom'; +import { useSearchParams } from 'next/navigation'; import { gbfsValidatorHeroBg, PromotionRow, @@ -14,7 +14,7 @@ import { useGbfsAuth } from '../../context/GbfsAuthProvider'; export default function GbfsValidator(): React.ReactElement { const theme = useTheme(); const { clearAuth } = useGbfsAuth(); - const [searchParams] = useSearchParams(); + const searchParams = useSearchParams(); const isInSearchState = searchParams.has('AutoDiscoveryUrl'); useEffect(() => { diff --git a/src/app/screens/PostRegistration.tsx b/src/app/screens/PostRegistration.tsx index fc00539b..94fdf6a9 100644 --- a/src/app/screens/PostRegistration.tsx +++ b/src/app/screens/PostRegistration.tsx @@ -16,15 +16,15 @@ import { type ProfileError } from '../types'; import { app } from '../../firebase'; import { useEffect } from 'react'; import { ACCOUNT_TARGET, ADD_FEED_TARGET } from '../constants/Navigation'; -import { useNavigate, useSearchParams } from 'react-router-dom'; +import { useRouter, useSearchParams } from 'next/navigation'; export default function PostRegistration(): React.ReactElement { const dispatch = useDispatch(); - const navigateTo = useNavigate(); + const router = useRouter(); const selectResendEmailSuccess = useSelector(selectIsVerificationEmailSent); const selectResendEmailError = useSelector(selectEmailVerificationError); const userProfileStatus = useSelector(selectUserProfileStatus); const [resendEmailSuccess, setResendEmailSuccess] = React.useState(false); - const [searchParams] = useSearchParams(); + const searchParams = useSearchParams(); const [resendEmailError, setResendEmailError] = React.useState(null); React.useEffect(() => { @@ -60,9 +60,9 @@ export default function PostRegistration(): React.ReactElement { userProfileStatus === 'authenticated' ) { if (searchParams.has('add_feed')) { - navigateTo(ADD_FEED_TARGET, { state: { from: 'registration' } }); + router.push(ADD_FEED_TARGET + '?from=registration'); } else { - navigateTo(ACCOUNT_TARGET); + router.push(ACCOUNT_TARGET); } } }, [userProfileStatus]); diff --git a/src/app/screens/SignUp.tsx b/src/app/screens/SignUp.tsx index 5a7b996f..bed11990 100644 --- a/src/app/screens/SignUp.tsx +++ b/src/app/screens/SignUp.tsx @@ -11,7 +11,7 @@ import Container from '@mui/material/Container'; import GoogleIcon from '@mui/icons-material/Google'; import GitHubIcon from '@mui/icons-material/GitHub'; import AppleIcon from '@mui/icons-material/Apple'; -import { useSearchParams, useNavigate } from 'react-router-dom'; +import { useSearchParams, useRouter } from 'next/navigation'; import * as Yup from 'yup'; import { useFormik } from 'formik'; import { useAppDispatch } from '../hooks'; @@ -51,9 +51,9 @@ export default function SignUp(): React.ReactElement { const [showPassword, setShowPassword] = React.useState(false); const [showConfirmPassword, setShowConfirmPassword] = React.useState(false); const [showNoEmailSnackbar, setShowNoEmailSnackbar] = React.useState(false); - const [searchParams] = useSearchParams(); + const searchParams = useSearchParams(); - const navigateTo = useNavigate(); + const router = useRouter(); const dispatch = useAppDispatch(); const signUpError = useSelector(selectSignUpError); const userProfileStatus = useSelector(selectUserProfileStatus); @@ -105,16 +105,16 @@ export default function SignUp(): React.ReactElement { React.useEffect(() => { if (userProfileStatus === 'registered') { if (searchParams.has('add_feed')) { - navigateTo(ADD_FEED_TARGET, { state: { from: 'registration' } }); + router.push(ADD_FEED_TARGET + '?from=registration'); } else { - navigateTo(ACCOUNT_TARGET); + router.push(ACCOUNT_TARGET); } } if (userProfileStatus === 'authenticated') { - navigateTo(COMPLETE_REGISTRATION_TARGET + '?' + searchParams.toString()); + router.push(COMPLETE_REGISTRATION_TARGET + '?' + searchParams.toString()); } if (userProfileStatus === 'unverified') { - navigateTo(POST_REGISTRATION_TARGET + '?' + searchParams.toString()); + router.push(POST_REGISTRATION_TARGET + '?' + searchParams.toString()); } }, [userProfileStatus]); diff --git a/src/app/store/profile-reducer.ts b/src/app/store/profile-reducer.ts index 34eec612..cccfac48 100644 --- a/src/app/store/profile-reducer.ts +++ b/src/app/store/profile-reducer.ts @@ -6,7 +6,6 @@ import { type OauthProvider, type ProfileErrors, } from '../types'; -import { type NavigateFunction } from 'react-router-dom'; import { type UserCredential } from 'firebase/auth'; interface UserProfileState { @@ -83,7 +82,7 @@ export const userProfileSlice = createSlice({ state, action: PayloadAction<{ redirectScreen: string; - navigateTo: NavigateFunction; + navigateTo: (path: string) => void; propagate: boolean; }>, ) => { diff --git a/src/app/store/saga/auth-saga.ts b/src/app/store/saga/auth-saga.ts index deb9ba13..4406f1d2 100644 --- a/src/app/store/saga/auth-saga.ts +++ b/src/app/store/saga/auth-saga.ts @@ -32,7 +32,6 @@ import { anonymousLoginFailed, anonymousLoginSkipped, } from '../profile-reducer'; -import { type NavigateFunction } from 'react-router-dom'; import { getUserFromSession, populateUserWithAdditionalInfo, @@ -88,7 +87,7 @@ function* logoutSaga({ payload: { redirectScreen, navigateTo, propagate }, }: PayloadAction<{ redirectScreen: string; - navigateTo: NavigateFunction; + navigateTo: (path: string) => void; propagate: boolean; }>): Generator { try {