Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update consent url #1157

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions client/components/mma/dataPrivacy/DataPrivacyPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from '../../../utilities/hooks/useAsyncLoader';
import { GenericErrorScreen } from '../../shared/GenericErrorScreen';
import { WithStandardTopMargin } from '../../shared/WithStandardTopMargin';
import { APIUseCredentials, identityFetch } from '../identity/idapi/fetch';
import * as UserAPI from '../identity/idapi/user';
import { ConsentOptions, mapSubscriptions } from '../identity/identity';
import { IdentityLocations } from '../identity/IdentityLocations';
Expand All @@ -22,7 +23,7 @@ import { dataPrivacyWrapper } from './DataPrivacy.styles';
import { LearnMoreSection } from './LearnMoreSection';
import { YourDataSection } from './YourDataSection';

type DataPrivacyResponse = [ConsentOption[], UserAPI.UserAPIResponse];
type DataPrivacyResponse = [ConsentOption[], UserAPI.UserAPIResponse, any];

const dataPrivacyFetcher = () =>
Promise.all([
Expand All @@ -34,6 +35,7 @@ const dataPrivacyFetcher = () =>
},
),
fetchWithDefaultParameters('/idapi/user'),
identityFetch('/users/me/consents', APIUseCredentials({})),
]);

export const DataPrivacyPage = () => {
Expand Down Expand Up @@ -73,7 +75,8 @@ export const DataPrivacyPage = () => {
* @param {DataPrivacyResponse} response
*/
const handleResponse = (response: DataPrivacyResponse) => {
const [consentOptions, userResponse] = response;
const [consentOptions, userResponse, consentResponse] = response;
console.log('CONSENT RESPONSE', consentResponse);
const user = UserAPI.toUser(userResponse);
const consentOpt = mapSubscriptions(user.consents, consentOptions);
dispatch(options(consentOpt));
Expand Down