Call buyLeaderboardSlot from client
This commit is contained in:
parent
de562799f4
commit
85c362d357
|
@ -21,3 +21,4 @@ export * from './update-user-metrics'
|
||||||
export * from './backup-db'
|
export * from './backup-db'
|
||||||
export * from './change-user-info'
|
export * from './change-user-info'
|
||||||
export * from './market-close-emails'
|
export * from './market-close-emails'
|
||||||
|
export * from './buy-leaderboard-slot'
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { ENV_CONFIG } from '../../common/envs/constants'
|
||||||
import { User } from '../../common/user'
|
import { User } from '../../common/user'
|
||||||
import { formatMoney } from '../../common/util/format'
|
import { formatMoney } from '../../common/util/format'
|
||||||
import { useUser } from '../hooks/use-user'
|
import { useUser } from '../hooks/use-user'
|
||||||
|
import { buyLeaderboardSlot } from '../lib/firebase/api-call'
|
||||||
import { AmountInput } from './amount-input'
|
import { AmountInput } from './amount-input'
|
||||||
import { Avatar } from './avatar'
|
import { Avatar } from './avatar'
|
||||||
import { Col } from './layout/col'
|
import { Col } from './layout/col'
|
||||||
|
@ -93,6 +94,12 @@ export function BuySlotModal(props: {
|
||||||
}
|
}
|
||||||
}, [user])
|
}, [user])
|
||||||
|
|
||||||
|
const onBuy = async () => {
|
||||||
|
// Feel free to change this. - James
|
||||||
|
const slotId = `${title}-${slot}`
|
||||||
|
await buyLeaderboardSlot({ slotId, reassessValue: newValue })
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Modal open={open} setOpen={setOpen}>
|
<Modal open={open} setOpen={setOpen}>
|
||||||
|
|
|
@ -66,3 +66,8 @@ export const changeUserInfo = (data: {
|
||||||
.then((r) => r.data as { status: string; message?: string })
|
.then((r) => r.data as { status: string; message?: string })
|
||||||
.catch((e) => ({ status: 'error', message: e.message }))
|
.catch((e) => ({ status: 'error', message: e.message }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const buyLeaderboardSlot = cloudFunction<
|
||||||
|
{ slotId: string; reassessValue: number },
|
||||||
|
{ status: 'success' | 'error'; message?: string }
|
||||||
|
>('buyLeaderboardSlot')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user