1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

refactor reserve-button component

we use "user" everywhere, this is more logical and this may fix an unreproductible issue with prepaid packs
This commit is contained in:
Sylvain 2021-11-22 14:13:35 +01:00
parent 2c0da56ff9
commit b74570c778
2 changed files with 5 additions and 5 deletions

View File

@ -1,4 +1,4 @@
#web: bundle exec rails server puma -p $PORT web: bundle exec rails server puma -p $PORT
worker: bundle exec sidekiq -C ./config/sidekiq.yml worker: bundle exec sidekiq -C ./config/sidekiq.yml
wp-client: bin/webpack-dev-server wp-client: bin/webpack-dev-server
wp-server: SERVER_BUNDLE_ONLY=yes bin/webpack --watch wp-server: SERVER_BUNDLE_ONLY=yes bin/webpack --watch

View File

@ -146,7 +146,7 @@ const ReserveButtonComponent: React.FC<ReserveButtonProps> = ({ currentUser, mac
// if the customer has already bought a pack or if there's no active packs for this machine, // if the customer has already bought a pack or if there's no active packs for this machine,
// or customer has not any subscription if admin active pack only for subscription option // or customer has not any subscription if admin active pack only for subscription option
// let the customer reserve // let the customer reserve
if (machine.current_user_has_packs || !machine.has_prepaid_packs_for_current_user || (isPackOnlyForSubscription && !currentUser.subscribed_plan)) { if (machine.current_user_has_packs || !machine.has_prepaid_packs_for_current_user || (isPackOnlyForSubscription && !user.subscribed_plan)) {
return onReserveMachine(machine); return onReserveMachine(machine);
} }
@ -168,14 +168,14 @@ const ReserveButtonComponent: React.FC<ReserveButtonProps> = ({ currentUser, mac
user={user} user={user}
machine={machine} machine={machine}
onEnrollRequested={onEnrollRequested} /> onEnrollRequested={onEnrollRequested} />
{machine && currentUser && <ProposePacksModal isOpen={proposePacks} {machine && user && <ProposePacksModal isOpen={proposePacks}
toggleModal={toggleProposePacksModal} toggleModal={toggleProposePacksModal}
item={machine} item={machine}
itemType="Machine" itemType="Machine"
onError={onError} onError={onError}
customer={currentUser} customer={user}
onDecline={onReserveMachine} onDecline={onReserveMachine}
operator={currentUser} operator={user}
onSuccess={handlePackBought} />} onSuccess={handlePackBought} />}
</span> </span>