Skip to content

Commit ddfe3a1

Browse files
committed
Fix api request to coingecko
1 parent e8ea9fe commit ddfe3a1

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

apps/server/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ import { errorMiddleware } from "./utils/middlewares";
2222
contentSecurityPolicy: {
2323
directives: {
2424
scriptSrc: isProd
25-
? ["'self'", "'unsafe-inline'"] // astro needs 'unsafe-inline', look into https://github.com/KindSpells/astro-shield
25+
? ["'self'", "'unsafe-inline'"] // astro needs 'unsafe-inline'
2626
: ["'self'", "'unsafe-eval'", "'unsafe-inline'"],
27+
connectSrc: ["'self'", "https://api.coingecko.com"],
2728
},
2829
},
2930
}),

apps/web/src/containers/Claim.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ export const Claim = () => {
2929
getClaimsByIds([id]).then((claims) => {
3030
setClaim(claims[0]);
3131
});
32-
33-
getBitcoinExchangeRate().then((rate) => {
34-
setUsdExchangeRate(rate);
35-
});
3632
}, [id]);
3733

3834
useEffect(() => {
3935
if (!claim || claim.status !== ClaimStatus.PAID) {
4036
return;
4137
}
4238

39+
getBitcoinExchangeRate().then((rate) => {
40+
setUsdExchangeRate(rate);
41+
});
42+
4343
const eventSource = subscribeSSE<{ paymentId: string }>(
4444
`${import.meta.env.PUBLIC_API_URL || ""}/api/payments/${claim.id}`,
4545
({ paymentId }) => {

0 commit comments

Comments
 (0)