Skip to content

Commit

Permalink
fix: appConfig from store instead of from search params
Browse files Browse the repository at this point in the history
  • Loading branch information
mirovladimitrovski committed Sep 7, 2023
1 parent 386df1a commit 63b5134
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/containers/AccountModal/forms/Registration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { useEffect, useMemo, useState, type ChangeEventHandler } from 're
import { object, string, SchemaOf } from 'yup';
import { useTranslation } from 'react-i18next';
import { useLocation, useNavigate } from 'react-router';
import { useSearchParams } from 'react-router-dom';
import { useQuery } from 'react-query';

import useForm, { UseFormOnSubmitHandler } from '#src/hooks/useForm';
Expand All @@ -11,16 +10,18 @@ import { extractConsentValues, checkConsentsFromValues } from '#src/utils/collec
import { addQueryParam } from '#src/utils/location';
import type { RegistrationFormData } from '#types/account';
import { getPublisherConsents, register, updateConsents } from '#src/stores/AccountController';
import { useConfigStore } from '#src/stores/ConfigStore';

const Registration = () => {
const navigate = useNavigate();
const location = useLocation();
const [searchParams] = useSearchParams();
const { t } = useTranslation('account');
const [consentValues, setConsentValues] = useState<Record<string, string | boolean>>({});
const [consentErrors, setConsentErrors] = useState<string[]>([]);

const { data, isLoading: publisherConsentsLoading } = useQuery(['consents', searchParams.get('app-config')], getPublisherConsents);
const appConfig = useConfigStore(({ config }) => config.id);

const { data, isLoading: publisherConsentsLoading } = useQuery(['consents', appConfig], getPublisherConsents);
const publisherConsents = useMemo(() => data?.consents || [], [data]);

const handleChangeConsent: ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement> = ({ currentTarget }) => {
Expand Down

0 comments on commit 63b5134

Please sign in to comment.