Skip to content

Commit

Permalink
Fix rewards claim
Browse files Browse the repository at this point in the history
  • Loading branch information
Reckless-Satoshi committed Jan 29, 2024
1 parent 61d6406 commit 042fbdc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion frontend/src/components/RobotInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,13 @@ const RobotInfo: React.FC<Props> = ({ coordinator, onClose }: Props) => {
if (robot != null && slot?.token != null && robot.encPrivKey != null) {
void signCleartextMessage(rewardInvoice, robot.encPrivKey, slot?.token).then(
(signedInvoice) => {
console.log('Signed message:', signedInvoice);
void coordinator.fetchReward(signedInvoice, garage, slot?.token).then((data) => {
console.log(data);
setBadInvoice(data.bad_invoice ?? '');
setShowRewardsSpinner(false);
setWithdrawn(data.successful_withdrawal);
setOpenClaimRewards(!(data.successful_withdrawal !== undefined));
setOpenClaimRewards(!data.successful_withdrawal);
});
},
);
Expand Down Expand Up @@ -307,6 +309,7 @@ const RobotInfo: React.FC<Props> = ({ coordinator, onClose }: Props) => {
<Grid item alignItems='stretch' style={{ display: 'flex', maxWidth: 80 }}>
<Button
sx={{ maxHeight: 38 }}
disabled={rewardInvoice === ''}
onClick={(e) => {
handleSubmitInvoiceClicked(e, rewardInvoice);
}}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/models/Coordinator.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ export class Coordinator {

const data = await apiClient.post(
this.url,
`${this.basePath}`,
`${this.basePath}/api/reward/`,
{
invoice: signedInvoice,
},
Expand Down

0 comments on commit 042fbdc

Please sign in to comment.