Skip to content

Commit

Permalink
fix: invalidate publisher consents on config change
Browse files Browse the repository at this point in the history
  • Loading branch information
mirovladimitrovski committed Aug 18, 2023
1 parent 02e4fc7 commit e78b05b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/containers/AccountModal/forms/Registration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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 @@ -14,11 +15,12 @@ import { getPublisherConsents, register, updateConsents } from '#src/stores/Acco
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'], getPublisherConsents);
const { data, isLoading: publisherConsentsLoading } = useQuery(['consents', searchParams.get('app-config')], getPublisherConsents);
const publisherConsents = useMemo(() => data?.consents || [], [data]);

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

0 comments on commit e78b05b

Please sign in to comment.