mirror of
https://github.com/MAGICGrants/campaign-site.git
synced 2026-01-09 12:27:59 -05:00
Merge pull request #43 from MAGICGrants/count-crypto-by-project
Count crypto by project
This commit is contained in:
@@ -158,8 +158,6 @@ export async function getServerSideProps({ params }: { params: any }) {
|
||||
|
||||
const content = await markdownToHtml(post.content || '')
|
||||
|
||||
const crypto = await fetchGetJSONAuthedBTCPay()
|
||||
|
||||
let stats : any = {};
|
||||
|
||||
for(let i=0;i<projects.length;i++){
|
||||
@@ -183,6 +181,7 @@ export async function getServerSideProps({ params }: { params: any }) {
|
||||
totaldonations: projects[i].fiattotaldonations,
|
||||
}
|
||||
} else {
|
||||
const crypto = await fetchGetJSONAuthedBTCPay(projects[i].slug)
|
||||
xmr = await crypto.xmr
|
||||
btc = await crypto.btc
|
||||
usd = await fetchGetJSONAuthedStripe()
|
||||
|
||||
@@ -65,7 +65,9 @@ export async function fetchPostJSONAuthed(
|
||||
}
|
||||
}
|
||||
|
||||
export async function fetchGetJSONAuthedBTCPay() {
|
||||
export async function fetchGetJSONAuthedBTCPay(
|
||||
slug: string
|
||||
) {
|
||||
try {
|
||||
const url = `${process.env.BTCPAY_URL!}stores/${process.env.BTCPAY_STORE_ID}/invoices`
|
||||
const auth = `token ${process.env.BTCPAY_API_KEY}`
|
||||
@@ -84,6 +86,9 @@ export async function fetchGetJSONAuthedBTCPay() {
|
||||
let totaldonationsinfiatxmr = 0
|
||||
let totaldonationsinfiatbtc = 0
|
||||
for(let i=0;i<data.length;i++){
|
||||
if (data[i].metadata.orderId != slug) {
|
||||
continue
|
||||
}
|
||||
const id = data[i].id
|
||||
const urliter = `${process.env.BTCPAY_URL!}stores/${process.env.BTCPAY_STORE_ID}/invoices/${id}/payment-methods`
|
||||
const authiter = `token ${process.env.BTCPAY_API_KEY}`
|
||||
|
||||
Reference in New Issue
Block a user