Fix up API call
This commit is contained in:
parent
93322e894d
commit
ed7aad5712
|
@ -26,7 +26,8 @@ Adapted from https://firebase.google.com/docs/functions/get-started
|
|||
0. `$ yarn dev` to spin up the emulators
|
||||
The Emulator UI is at http://localhost:4000; the functions are hosted on :5001.
|
||||
Note: You have to kill and restart emulators when you change code; no hot reload =(
|
||||
1. Connect to emulators by enabling `functions.useEmulator('localhost', 5001)`
|
||||
Note2: You may even have to find the process ID of the emulator and kill it manually.
|
||||
1. Connect by uncommenting the `connectFunctionsEmulator` in `web/lib/firebase/api-call.ts`
|
||||
|
||||
## Debugging
|
||||
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
import { getFunctions, httpsCallable } from 'firebase/functions'
|
||||
import {
|
||||
getFunctions,
|
||||
httpsCallable,
|
||||
connectFunctionsEmulator,
|
||||
} from 'firebase/functions'
|
||||
import { Fold } from '../../../common/fold'
|
||||
import { User } from '../../../common/user'
|
||||
import { randomString } from '../../../common/util/random'
|
||||
import './init'
|
||||
|
||||
const functions = getFunctions()
|
||||
// Uncomment to connect to local emulators:
|
||||
// connectFunctionsEmulator(functions, 'localhost', 5001)
|
||||
|
||||
export const cloudFunction = <RequestData, ResponseData>(name: string) =>
|
||||
httpsCallable<RequestData, ResponseData>(functions, name)
|
||||
|
|
|
@ -117,13 +117,15 @@ function DonationBox(props: { user?: User | null }) {
|
|||
e.preventDefault()
|
||||
setIsSubmitting(true)
|
||||
setError(undefined)
|
||||
// TODO await sending to db
|
||||
await transact({
|
||||
amount,
|
||||
toId: 'asdfsasdf', // TODO hardcode in Manifold Markets official account
|
||||
// TODO hardcode in Manifold Markets official account.
|
||||
// Or should we just have it go into a void?
|
||||
toId: 'igi2zGXsfxYPgB0DJTXVJVmwCOr2', // akrolsmir@gmail in Dev env
|
||||
category: 'TO_CHARITY',
|
||||
data: {
|
||||
charityId: 'fjdkslasdf', // TODO fill in
|
||||
description: `${user?.name} donated M$ ${amount} to wellgive`,
|
||||
txnData: {
|
||||
charityId: 'wellgive', // TODO fill in
|
||||
},
|
||||
})
|
||||
setIsSubmitting(false)
|
||||
|
|
Loading…
Reference in New Issue
Block a user