⛄ Snowberb ⛄ – 13-38 Jul 4

How can I wait to simultaneous promises but without using Promise.allSettled?
export const getStaticProps: GetStaticProps = async () => {
const { bettingBonuses, casinoBonuses } = getBonuses
const { getAccounts, getTransactions } = getAccountInfo
const bonusPromises = await Promise.allSettled([bettingBonuses(), casinoBonuses()])

const bonuses: IBonus[] = []
const accounts = await getAccounts()
const transactions = await getTransactions()

bonusPromises.forEach(
(promise) => promise.status === 'fulfilled' && bonuses.push(...promise.value)
)

return {
props: {
bonuses,
savedAccounts: accounts,
savedTransactions: transactions,
},
}
}
export const getStaticProps: GetStaticProps = async () => {
const { bettingBonuses, casinoBonuses } = getBonuses
const { getAccounts, getTransactions } = getAccountInfo
const bonusPromises = await Promise.allSettled([bettingBonuses(), casinoBonuses()])

const bonuses: IBonus[] = []
const accounts = await getAccounts()
const transactions = await getTransactions()

bonusPromises.forEach(
(promise) => promise.status === 'fulfilled' && bonuses.push(...promise.value)
)

return {
props: {
bonuses,
savedAccounts: accounts,
savedTransactions: transactions,
},
}
}
I want to load bonuses, accounts and transactions independently of eachother
S
Sniberb654d ago
My problem is that I need the info for different Tabs in the same page bonuses is needed for the Bets tab, but not for the Accounts tab and viceversa
UU
Unknown User653d ago