Skip to content

Commit

Permalink
See pewresearch/pewresearch-org@57c5cf5 from refs/heads/release/5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
prcdevgitbot committed Feb 22, 2024
1 parent d5e3439 commit c1ec261
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion includes/datasets/build/download-block/view.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('@wordpress/interactivity', 'wp-polyfill'), 'version' => '4b20554576f21acb4ee6', 'type' => 'module');
<?php return array('dependencies' => array('@wordpress/interactivity', 'wp-polyfill'), 'version' => 'c81c8a673ea2105706fa', 'type' => 'module');
2 changes: 1 addition & 1 deletion includes/datasets/build/download-block/view.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion includes/datasets/build/download-block/view.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 10 additions & 12 deletions includes/datasets/src/download-block/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { store, getContext, getElement } from '@wordpress/interactivity';

const { actions } = store('prc-platform/dataset-download', {
actions: {
downloadDataset: (datasetId, userId, userToken) => {
downloadDataset: (datasetId, uid, token) => {
window?.wp
?.apiFetch({
path: `/prc-api/v3/datasets/get-download/?datasetId=${datasetId}`,
Expand All @@ -16,8 +16,8 @@ const { actions } = store('prc-platform/dataset-download', {
'Content-Type': 'application/json',
},
body: JSON.stringify({
uid: userId,
userToken,
uid,
userToken: token,
}),
})
.then((response) => {
Expand All @@ -37,24 +37,22 @@ const { actions } = store('prc-platform/dataset-download', {
const context = getContext();
const { datasetId, isATP } = context;

const contentGateContext = getContext(
'prc-user-accounts/content-gate'
);
const { userToken, userId } = contentGateContext;
const { state } = store('prc-user-accounts/content-gate');
const { token, uid } = state;

console.log(
'onButtonClick: "Hit the api with this information..." ->',
contentGateContext,
userToken,
userId,
state,
token,
uid,
datasetId
);

if (isATP) {
console.log('isATP');
actions.checkATP(userId, userToken, datasetId);
actions.checkATP(uid, token, datasetId);
} else {
actions.downloadDataset(datasetId, userId, userToken);
actions.downloadDataset(datasetId, uid, token);
}
},
async checkATP(userId, userToken, datasetId) {
Expand Down

0 comments on commit c1ec261

Please sign in to comment.