Skip to content

Commit

Permalink
fix: Properly POST un-authed user policies (#1781)
Browse files Browse the repository at this point in the history
  • Loading branch information
anth-volk authored Jun 3, 2024
1 parent d82c455 commit 6d6cdd0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/pages/UserProfilePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export default function UserProfilePage(props) {
};

try {
await postUserPolicy(countryId, policy);
await postUserPolicy(policy.country_id, policy);
} catch (err) {
// If for some reason, policy addition fails,
// add it to a failed attempts array - this will
Expand Down Expand Up @@ -430,12 +430,13 @@ function UserProfileSection(props) {

function PolicySimulationCard(props) {
const { metadata, userPolicy, keyValue } = props;
console.log(Object.keys(metadata));

const CURRENT_API_VERSION = metadata?.version;
const geography =
metadata.economy_options.region.filter(
(region) => region.name === userPolicy.geography,
)[0].label || "Unknown";
)[0]?.label || "Unknown";

const apiVersion = userPolicy.api_version;
const dateAdded = userPolicy.added_date;
Expand Down
6 changes: 5 additions & 1 deletion src/pages/policy/output/PolicyOutput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ export default function PolicyOutput(props) {
let failedAttempts = [];
let policyId = null;
try {
policyId = await postUserPolicy(countryId, policyToSave);
policyId = await postUserPolicy(
policyToSave.country_id,
policyToSave,
);

setUserPolicyId(policyId);
} catch (err) {
failedAttempts = failedAttempts.concat(policyToSave);
Expand Down

0 comments on commit 6d6cdd0

Please sign in to comment.