Skip to content

Commit

Permalink
fix: plans prompt after social register (#498)
Browse files Browse the repository at this point in the history
  • Loading branch information
mirovladimitrovski authored and AntonLantukh committed Apr 22, 2024
1 parent c2e3f52 commit fa8c142
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import AccountController from '@jwp/ott-common/src/controllers/AccountController
import { checkConsentsFromValues, extractConsentValues, formatConsentsFromValues } from '@jwp/ott-common/src/utils/collection';
import useSocialLoginUrls from '@jwp/ott-hooks-react/src/useSocialLoginUrls';
import useForm from '@jwp/ott-hooks-react/src/useForm';
import { modalURLFromLocation } from '@jwp/ott-ui-react/src/utils/location';
import { modalURLFromLocation, modalURLFromWindowLocation } from '@jwp/ott-ui-react/src/utils/location';
import { useAccountStore } from '@jwp/ott-common/src/stores/AccountStore';

import RegistrationForm from '../../../components/RegistrationForm/RegistrationForm';
Expand Down Expand Up @@ -55,7 +55,7 @@ const Registration = () => {
setConsentValues(extractConsentValues(publisherConsents));
}, [accountController, publisherConsents]);

const socialLoginURLs = useSocialLoginUrls(window.location.href.split('?')[0]);
const socialLoginURLs = useSocialLoginUrls(modalURLFromWindowLocation('personal-details'));

const { handleSubmit, handleChange, handleBlur, values, errors, validationSchemaError, submitting } = useForm<RegistrationFormData>({
initialValues: { email: '', password: '' },
Expand Down
3 changes: 2 additions & 1 deletion platforms/web/src/containers/AppRoutes/AppRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
PATH_USER_PROFILES_EDIT_PROFILE,
PATH_SEARCH,
PATH_USER,
PATH_HOME,
} from '@jwp/ott-common/src/paths';

import useNotifications from '#src/hooks/useNotifications';
Expand All @@ -53,7 +54,7 @@ export default function AppRoutes() {
useNotifications();

if (userData.user && !userData.loading && window.location.href.includes('#token')) {
return <Navigate to="/" />; // component instead of hook to prevent extra re-renders
return <Navigate to={`${PATH_HOME}${location.search}`} />; // component instead of hook to prevent extra re-renders
}

if (userData.user && selectingProfileAvatar !== null) {
Expand Down

0 comments on commit fa8c142

Please sign in to comment.