Merge branch 'AW-102-default-product' into 'develop'
AW-102-default-product See merge request witapp/aura-webapp!168
This commit is contained in:
commit
b08dbc61e9
@ -25,7 +25,7 @@ export default function StepSubscriptionPlan() {
|
|||||||
});
|
});
|
||||||
const defaultProduct = properties.find(
|
const defaultProduct = properties.find(
|
||||||
(property) => property.key === "default.product"
|
(property) => property.key === "default.product"
|
||||||
)?._id;
|
)?.value;
|
||||||
|
|
||||||
const storedEmail = steps.getStoredValue(Step.Email);
|
const storedEmail = steps.getStoredValue(Step.Email);
|
||||||
|
|
||||||
@ -34,18 +34,19 @@ export default function StepSubscriptionPlan() {
|
|||||||
const [email, setEmail] = React.useState(steps.getStoredValue(Step.Email));
|
const [email, setEmail] = React.useState(steps.getStoredValue(Step.Email));
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (!defaultProduct) return;
|
if (!defaultProduct || activeProductFromStore) return;
|
||||||
const targetDefaultProduct = products.find((p) => p._id === defaultProduct);
|
const targetDefaultProduct = products.find((p) => p.key === defaultProduct);
|
||||||
if (!targetDefaultProduct) return;
|
if (!targetDefaultProduct) return;
|
||||||
|
|
||||||
setProduct(defaultProduct);
|
setProduct(targetDefaultProduct._id);
|
||||||
steps.saveCurrent(defaultProduct);
|
steps.saveCurrent(targetDefaultProduct._id);
|
||||||
dispatch(
|
dispatch(
|
||||||
actions.payment.update({
|
actions.payment.update({
|
||||||
activeProduct: targetDefaultProduct,
|
activeProduct: targetDefaultProduct,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}, [defaultProduct, dispatch, products, steps]);
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [defaultProduct]);
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (activeProductFromStore) {
|
if (activeProductFromStore) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user