Skip to content

Commit

Permalink
feat: trigger fee calculation when toggling "Publish accepted".
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitdevos committed Oct 27, 2023
1 parent 4c38f94 commit 93b571e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
21 changes: 12 additions & 9 deletions src/loc/OpenLoc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ export default function OpenLoc(props: Props) {
if(fees === undefined && client) {
setFees(null);
(async function() {
if (locState instanceof AcceptedRequest) {
if (locState.data().locType === "Collection") {
const apiLimits = await limits.toApiLimits(client.logionApi)
if (locState instanceof AcceptedRequest) {
if (locState.data().locType === "Collection") {
const apiLimits = await limits.toApiLimits(client.logionApi)
setFees(await locState.estimateFeesOpenCollection({
...apiLimits,
autoPublish,
...apiLimits,
autoPublish,
}));
} else {
setFees(await locState.estimateFeesOpen(autoPublish));
}
} else {
setFees(await locState.estimateFeesOpen({ autoPublish }));
}
}
})();
}
}, [ fees, client, props.loc, limits, locState, autoPublish ]);
Expand Down Expand Up @@ -140,7 +140,10 @@ export default function OpenLoc(props: Props) {
<Checkbox
skin="Toggle white"
checked={ autoPublish }
setChecked={ (value) => setAutoPublish(value) }
setChecked={ (value) => {
setAutoPublish(value);
setFees(undefined);
}}
disabled={ !canAutoPublish }
/>
</div>
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2977,14 +2977,14 @@ __metadata:
linkType: hard

"@logion/client@npm:^0.33.0-1, @logion/client@npm:^0.33.0-2":
version: 0.33.0-10
resolution: "@logion/client@npm:0.33.0-10"
version: 0.33.0-12
resolution: "@logion/client@npm:0.33.0-12"
dependencies:
"@logion/node-api": ^0.24.0-2
"@logion/node-api": ^0.24.0-3
axios: ^0.27.2
luxon: ^3.0.1
mime-db: ^1.52.0
checksum: b25e8c6ae8df99e593b09ea8a62b4fc42e3ba4bfc38b86eeae71710919d0f352feefd37ddfb215a5f9bd51940cf0496a242dd2d33d974b1639fba4b2d7d76bb9
checksum: acb0b6d7bfe5f4ddea0e5e8a76301b643103cacff534276ab588ceeddb839c08b902176c0705d895850930173f2aa7751de4f9284f284936f050b725a5b4abed
languageName: node
linkType: hard

Expand Down Expand Up @@ -3020,17 +3020,17 @@ __metadata:
languageName: node
linkType: hard

"@logion/node-api@npm:^0.24.0-2":
version: 0.24.0-2
resolution: "@logion/node-api@npm:0.24.0-2"
"@logion/node-api@npm:^0.24.0-3":
version: 0.24.0-3
resolution: "@logion/node-api@npm:0.24.0-3"
dependencies:
"@polkadot/api": ^10.10.1
"@polkadot/util": ^12.5.1
"@polkadot/util-crypto": ^12.5.1
"@types/uuid": ^9.0.2
fast-sha256: ^1.3.0
uuid: ^9.0.0
checksum: a6ab3bf882e18a9cc61723f98f23a499760ac9dc450cdc125d36123dc96b30a35d1588ac60fe788adb6dc6a731befa8a4119fa568270e4fd37fd5bb31cb3912d
checksum: 063027abf5fd3851a3944fb19b2d20ec3b924d1ab18d61ea0f4c656a09801c1dd230b59d9eeb454a0a963755ad3a17f5c13a2e3b3fe51c3e9842acc9bdc3d04a
languageName: node
linkType: hard

Expand Down

0 comments on commit 93b571e

Please sign in to comment.